0

Suggestion: Respect JS cancellation of a <yml:form> submission

If I add a "submit" event listener to a <yml:form> to do form validation, and my event handler cancels the event, then the form should not be submitted.

CODE
// $("my-button").parentNode is the form element.
listen($("my-button").parentNode, "submit", function(e) {
if (!validateFormValues()) {
// Either of the following two lines, taken alone, should cancel the form submission.
e.preventDefault();
return false;
}
});

by
1 Reply
  • Hi Jared - trying to follow up on a bunch of forum posts. For immediate action you can also send me an e-mail directly. I'm going to add this to my list of bugs to be filed on the system (first running tests to confirm and build potential workarounds). I'll file as soon as I can, but the functionality will probably not be added for the next platform revision.

    Thanks.

    Jonathan LeBlanc
    Senior Software Engineer
    Yahoo! Developer Network
    Twitter: jcleblanc

    QUOTE (Jared @ Apr 16 2009, 02:37 PM) <{POST_SNAPBACK}>
    If I add a "submit" event listener to a <yml:form> to do form validation, and my event handler cancels the event, then the form should not be submitted.

    CODE
    // $("my-button").parentNode is the form element.
    listen($("my-button").parentNode, "submit", function(e) {
    if (!validateFormValues()) {
    // Either of the following two lines, taken alone, should cancel the form submission.
    e.preventDefault();
    return false;
    }
    });
    0
This forum is locked.

Recent Posts

in Y!OS Suggestions