Hi,
I'm still stuck here.. I tried a few other things. I just want to show/hide
#nnd based on whether or not #cnd is checked. This example is in the
manual, but I still cannot get it to work..
Here's the form-
fields = []
fields.append( Field( 'cnd', 'boolean', default=True) )
fields.append( Field( 'nnd') )
form = SQLFORM.factory(*fields)
And the view-
<script>
jQuery(document).ready(function()
{
jQuery('#no_table_nnd__row').hide();
jQuery('#no_table_cnd').change(function(){
if( jQuery('#no_table_cnd').attr('checked') );
jQuery('#no_table_nnd__row').show();
else
jQuery('#no_table_nnd__row').hide();});
});
</script>
But still the input box stays visible regardless of the status of the
checkbox.. :( Any help would be greatly appreciated.
Thanks,
-j
On Fri, Jun 21, 2013 at 2:07 PM, Jordan Ladora
<[email protected]>wrote:
> Hi,
>
> I have a jQuery script in a view. It has a bug as it's not working
> (textbox always shown). I think my syntax in the if statement is wrong..
> here it is-
>
> <script>
>
> jQuery(document).ready(
> function()
> {
> if( jQuery('#cnd').prop('checked', true) );
> {
> jQuery('#nnd').show();
> }
> else
> {
> jQuery('#nnd').hide();
> }
>
> }
> );
>
> </script>
>
>
> The element with id #cnd is a checkbox, and the element #nnd is a textbox.
> Putting a single line inside the doc ready function, eg
>
> jQuery('#nnd').show();
>
> hides or shows the box just fine.
>
> Thanks for any help!!!
>
> -jl
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/EqxNV-LO7oY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.