Hi everyone,

When I am using the SQLFORM.widgets.radio.widget my jquery selection code 
does not work. If I comment out the widget it works fine. Does anyone know 
if there is a workaround or is it just not possible to combine the two 
together.

In the Model...

db.define_table('leads',

    Field('contact_result',
          requires=IS_IN_SET(['Appointment', 'Gatekeeper',
                              'National/Head Office', 'Not Interested',
                              'Send Information', 'Call Back Later']),
          default='Appointment',
          widget=SQLFORM.widgets.radio.widget
          ),

and in the View... (controller is essentially SQLFORM)

{{extend 'layout.html'}}
{{=form}}
<script>
    jQuery(document).ready(function() {

        if(jQuery('#leads_contact_result option:selected').text()=='Send 
Information') {
            jQuery('#leads_info_email__row').show();
        }
        else
        { jQuery('#leads_info_email__row').hide();
        }
        jQuery('#leads_contact_result').change(function() {
            if(jQuery('#leads_contact_result 
option:selected').text()=='Send Information') {
                jQuery('#leads_info_email__row').show();
            }
            else
            { jQuery('#leads_info_email__row').hide();
            }
        });

        if(jQuery('#leads_contact_result option:selected').text()=='Call 
Back Later') {
            jQuery('#leads_recontact__row').show();
        }
        else
        { jQuery('#leads_recontact__row').hide();
        }
        jQuery('#leads_contact_result').change(function() {
            if(jQuery('#leads_contact_result 
option:selected').text()=='Call Back Later') {
                jQuery('#leads_recontact__row').show();
            }
            else
            { jQuery('#leads_recontact__row').hide();
            }
        });

    })
</script>

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

Reply via email to