The submit is trapped by web2py.js 

This can be prevented by adding " _class=no_trap" to the form.

On Sunday, 1 April 2012 16:50:18 UTC+1, Ronghui Yu wrote:
>
> Hi, All,
>
> I have a piece of HTML that generated by LOAD helper. And there is a form 
> in it, quite similar to that component plugin_comment described in web2py 
> online book.
> The problem I have now is, I want the prevent the form submitting if 
> failure to validate some fields, but I am not able to do that even I have 
> the javascript like below, which works for forms not in a component
>
> <script type="text/javascript">
>       jQuery(document).ready(function(){
>             jQuery("#someform").submit(function(event) {
>                   if (fail_to_validate()) {
>                       event.preventDefault();
>                       return false;
>                    }
>            });
>     });
> </script>
>
> I found that the form will always be submitted event with ajax_trap=True 
> or ajax_trap=False, and with or without the above script.
> Anyone could give me some clue?
>
> Thanks in advance.
>
> -- 
> ===========================
> Regards
> Ronghui Yu
>  

Reply via email to