PDA

View Full Version : Date field blur event on submit button click



yyogev
8 Nov 2010, 4:46 AM
Hello,

I have a task form with a target date field. when that date is changed so that the task is delayed, the change event triggers a dialog box that asks the user for the reason for this delay. the user's answer is saved in a hidden field.
Since the change event is triggered on blur, it happens also that the user gets this dialog box after clicking on "submit changes". however, it is not followed by the click event and so the form is not submitted, which is counter-intuitive to the user.

How can I discover that the click on the submit button caused the blur, so I can follow the dialog box with form submission ?

Thanks,
Yaron

plalx
8 Nov 2010, 7:59 AM
Probably far from being the best solution... but you can try something like this. Listen to the mousedown event of the button and set a flag that means that the user meant to click the submit button. In your dialogbox callback function, check if that flag is true and if it is, perform the submit.



{
text: 'Submit',
listeners: {
'render': function() {
this.btnEl.on({
'mousedown': function() {
form.submitNext = true;
}
});
}
}
}

yyogev
8 Nov 2010, 8:43 AM
Thanks. I'll try this.