PDA

View Full Version : Radiofields and Double tapping



jerome76
19 Jul 2012, 1:08 PM
There have been issues with grouped radio buttons where the user cannot remove a checked radio field. Currently in my other software, there is a custom JavaScript function that handles a double-click event to uncheck the corresponding radio button. These double-click events do not come standard for html radio buttons, but in some circumstances, it would be a necessity.

For example:
Say there are three radio buttons grouped by the same 'name'. It is not a required answer for the form, so the form can be submitted without one of the buttons being checked. The user accidentally, or unknowingly, checks one of the radio buttons while filling out the form. After realizing the answer is not required, the user wants to remove that check from the radio button, but the user cannot and must submit the form with that answer or start the whole form over again.
------------

My question is, is there a possibility that this double-tap event will become a standard in future versions of ST? If not, and I did some research, is there any implementations someone created that utilizes such a feature? It's been a long day so I may have overlooked something.

Best regards,

Brian

mitchellsimoens
21 Jul 2012, 12:31 PM
This seems like an application specific feature as a user I wouldn't expect it to uncheck. Radio fields shouldn't be uncheckable.

jerome76
21 Jul 2012, 4:31 PM
Seems so..

If anyone is interested, here is an override to implement this behavior.


Ext.field.Radio.override({
// @private
onMaskTap: function(component, e) {
var me = this,
dom = component.input.dom;


if (me.getDisabled()) {
return false;
}


// if (!me.getChecked()) {
// dom.checked = true;
// }
dom.checked = !me.getChecked(); //allow user to remove radio input


me.refreshGroupValues();


//return false so the mask does not disappear
return false;
}
});