It's probably just a typo, but shouldn't there be a semi-colon after the line that is "// WORKING" as a comment? You need to separate javascript lines with semi-colons, except for the last statement in a function. (But even there it doesn't hurt anything if you put one in.)
Get Firebug on Firefox and open the "console" pane. It shows you if you have any javascript errors. -- Joe B. On Wednesday, July 24, 2013 10:05:52 PM UTC-7, Prasad Muley wrote: > > Hello All, > I am newbie web2py programmer. I tried to do custom validation > using jQuery but not gettng expected result. Code is as followed: > > *Model-db.py* > > db.define_table('taxpayer', > Field('name'), > Field('married','boolean'), > Field('spouse_name') > ) > # I don't want use IS_NOT_EMPTY() in this table > > *Controller-default.py* > > def taxer(): > grid=SQLFORM.grid(db.taxpayer,user_signature=False) > if request.args(0) in ['edit']: > form=grid.update_form > if form.process().accepted: > response.flash=form.vars > return dict(grid=grid) > > * > * > *View- default/taxer.html* > > {{extend 'layout.html'}} > {{=grid}} > <script> > jQuery(document).ready( function(){ > var flag=0 > jQuery('.web2py_form').submit(function(){ > //Getting value from tracker status > var get_name=jQuery('#taxpayer_name').val() > if(get_name =="") { > if(flag==0) { > //alert("Please Enter valid Name"); WORKING > jQuery("<div class='error'>Please Enter > Valid Name</div>").appendTo("#taxpayer_name__label") // WORKING > jQuery("<div class='error'>Please Enter > Valid Name</div>").appendTo("#taxpayer_name") // NOT WORKING > flag=1 > } > return false > } > }); > }); > </script> > > Please help me for this. > I want to display error message for 'name' field as IS_NOT_EMPTY() does. > It successfully does for taxpayer_name__label even as well as > taxpayer_name__row but isn't working for taxpayer_name id. > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.