Try this.
$(document).ready(function(){
$('#taxpayer_spouse_name__row').hide();
$('#taxpayer_married').change(function(){
if($('#taxpayer_married').attr('checked'))
$('#taxpayer_spouse_name__row').show();
else $('#taxpayer_spouse_name__row').hide();});
});
then try replace $ with jQuery
On Aug 11, 11:04 am, __Kyo__ <[email protected]> wrote:
> I tested the code you gave me and still does not work, I also work
> with the same code that brings up the manual and does not work either.
> What can I do? Apologies for the delay. Thanks in advance
>
> --Model(this code is taken from web2py manual)
> db=SQLDB('sqlite://db.db')
> db.define_table('taxpayer',
> SQLField('name'),
> SQLField('married','boolean'),
> SQLField('spouse_name'))
>
> --Controller (this code is taken from web2py manual)
> def index():
> form=SQLFORM(db.taxpayer)
> if form.accepts(request.vars,session):
> response.flash='record inserted'
> return dict(form=form)
>
> --View(this code is taken from web2py manual)
> {{extend 'layout.html'}}
> {{=form}}
> <script>
> $(document).ready(function(){
> $('#taxpayer_spouse_name__row').hide();
> $('#taxpayer_married').attr('onchange',
> "if($('#taxpayer_married').attr('checked'))
> $('#taxpayer_spouse_name__row').show();
> else $('#taxpayer_spouse_name__row').hide();");});
>
> </script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---