return (typeOf retVal === "undefined" || retVal === true) in all other cases stop the submit
looks OK ? On Fri, Sep 16, 2011 at 8:57 PM, Martin Grigorov <[email protected]> wrote: > Yes, sounds like a good idea. > What if the user code returns an object ? > > On Fri, Sep 16, 2011 at 6:11 PM, Igor Vaynberg <[email protected]> > wrote: >> i think in this case we should define the undefined to be true... >> >> -igor >> >> On Fri, Sep 16, 2011 at 5:56 AM, Martin Grigorov <[email protected]> >> wrote: >>> it seems in your code you have <form onsubmit="something();"> without >>> returning anything. Since 'if (undefined)' is 'false' the call stops >>> there. >>> >>> On Fri, Sep 16, 2011 at 3:25 PM, Wayne W <[email protected]> >>> wrote: >>>> and in what case does it not return anything? >>>> >>>> >>>> On Fri, Sep 16, 2011 at 5:04 PM, Martin Grigorov <[email protected]> >>>> wrote: >>>>> It should return true or false. >>>>> False if there is some reason to not submit the form, for example >>>>> client side validation failed. >>>>> True if everything is OK and the submit can proceed. >>>>> >>>>> On Fri, Sep 16, 2011 at 6:21 AM, Wayne W <[email protected]> >>>>> wrote: >>>>>> Hi, >>>>>> >>>>>> I'm trying to upgrade from 1.4.8 to 1.4.18 and I'm finding that >>>>>> AjaxSubmitLink is not working (at least with one form). >>>>>> >>>>>> The form doesn't get submitted - the problem in wicket-ajax.js is (~line >>>>>> 1120): >>>>>> >>>>>> // Submits a form using ajax. >>>>>> // This method serializes a form and sends it as POST body. >>>>>> submitForm: function(form, submitButton) { >>>>>> var submittingAttribute = 'data-wicket-submitting'; >>>>>> if (form.onsubmit && >>>>>> !form.getAttribute(submittingAttribute)) { >>>>>> form.setAttribute(submittingAttribute, >>>>>> submittingAttribute); >>>>>> var retValue = form.onsubmit(); >>>>>> form.removeAttribute(submittingAttribute); >>>>>> if (!retValue) return; >>>>>> } >>>>>> >>>>>> >>>>>> The problem is var retValue = form.onsubmit(); does not return any >>>>>> value (retValue remains undefined) and hence it returns and doesn't do >>>>>> the submit. I don't know enough about javascript to really understand >>>>>> whats happening here. The form is fairly unremarkable. >>>>>> >>>>>> For now I've patch the wicket-ajax.js code and comment out the return, >>>>>> and it works fine again. I notice this code here was not in 1.4.8. But >>>>>> obviously this is not the solution. >>>>>> >>>>>> So I imagine it something to do with the form, but I don't know where >>>>>> to start and look - what is normally returned by form.onsubmit();? >>>>>> what can I look for? >>>>>> >>>>>> many thanks >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Martin Grigorov >>>>> jWeekend >>>>> Training, Consulting, Development >>>>> http://jWeekend.com >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> >>> >>> -- >>> Martin Grigorov >>> jWeekend >>> Training, Consulting, Development >>> http://jWeekend.com >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
