I am trying out the 11.2.1 book example on p.504, and it just doesn't 
function at all. I've tried it with Firefox and Chromium and the behavior 
is the same. Instead of the spouse name field appearing when the box is 
checked, nothing happens. I've checked the book code against the web book 
code against my code and they all appear to be the same.

Please help find my error!

Here's a cut and paste from the relevant book section:

*As an example, create an input form that asks for a taxpayer's name and 
for the name of the taxpayer's spouse, but only if he/she is married.
Create a test application with the following model:
*

db = DAL('sqlite://db.db')
db.define_table('taxpayer',
    Field('name'),
    Field('married', 'boolean'),
    Field('spouse_name'))


*the following "default.py" controller:*

def index():
    form = SQLFORM(db.taxpayer)
    if form.process().accepted:
        response.flash = 'record inserted'
    return dict(form=form)
 
*and the following "default/index.html" view:
*
{{extend 'layout.html'}}
{{=form}}
<script>
jQuery(document).ready(function(){
   jQuery('#taxpayer_spouse_name__row').hide();
   jQuery('#taxpayer_married').change(function(){
        if(jQuery('#taxpayer_married').attr('checked'))
            jQuery('#taxpayer_spouse_name__row').show();
        else jQuery('#taxpayer_spouse_name__row').hide();});
});
</script>

*The script in the view has the effect of hiding the row containing the 
spouse's name:
*

Unfortunately, in my tests, there's no effect. It certainly *looks* from 
the code as though the row should appear and disappear based on the 
checkbox, but it doesn't seem to be happening for me. Why doesn't it work?

Does it work for you?

Thanks.....


-- 

--- 
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.

Reply via email to