Hello, I wrote this into my custom form code :
<script> jQuery(document).ready(function(){ jQuery('#documents_card').change(function(){ var sel_value = $('#documents_card').val(); # this is working ok and get the card number selected by user var name = call_name(sel_value); # this is a function in db.py to retrieve firstname and secondname fields value. THIS NOT WORK!! alert(name);}); }); </script> Somebody can help me!! Thanks. El martes, 29 de julio de 2014 09:58:01 UTC-6, ocascante escribió: > > Massimo, my tables: > > db.define_table('cards', > Field('card','string',unique=True,required=True), > Field('firstname','string',required=True), > Field('secondname','string',required=True), > > db.define_table('documents', > Field('card'requires=IS_IN_DB(db,db.cards.card)), > Field('document','string',required=True), > Field('state','string'), > > The form is to include documents. > > El martes, 29 de julio de 2014 09:51:07 UTC-6, Massimo Di Pierro escribió: >> >> Not sure what the card widget is in your example. Probably you want >> onkeyup instead of onchange. Anyway, if you share your model and your js >> code we can help more. >> >> On Tuesday, 29 July 2014 10:40:54 UTC-5, ocascante wrote: >>> >>> Hello, >>> >>> I have this custom form: >>> >>> {{extend 'layout.html'}} >>> <center> >>> <img src="/scdoc/static/logo.png" width="44%" alt="Logo"> >>> </center> >>> <H2> >>> <CENTER> >>> Documental System >>> </CENTER> >>> </H2> >>> <h3> >>> <center> >>> New Records >>> </center> >>> </h3> >>> {{=form.custom.begin}} >>> <table border="0" width="75%" height="auto"><tr> >>> <td>Card Number: {{=form.custom.widget.card}}</td> >>> <td>Document: {{=form.custom.widget.document}}</td> >>> </tr></table> >>> <table border="0" width="81%" height="auto"><tr> >>> <td>State: {{=form.custom.widget.state}}</td> >>> </tr></table> >>> <div> >>> Click to submint: {{=form.custom.submit}} >>> </div> >>> {{=form.custom.end}} >>> >>> When the user choose a card, i need to read from other table the first >>> name, second name of this card, and display that information. >>> I am trying with jquery onchange but is not working. >>> Thanks. >>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.