More in this section

Forums / Developing with Sitefinity / Show/hide form textboxes based upon form dropdown list selection

Show/hide form textboxes based upon form dropdown list selection

2 posts, 0 answered
  1. Richard
    Richard avatar
    49 posts
    Registered:
    13 Jul 2010
    21 Aug 2012
    Link to this post
    Hello all, me again.

    Ok I have a form that has a drop down list with two options: Free trial & full

    Depending upon which of these is selected, I would like to show/hide subsequent form textboxes.

    How would I go about doing this?

    Is it possible to add jquery functionality to specific forms?

    Any advice greatly received.

    Rich
  2. Randy Garza
    Randy Garza avatar
    19 posts
    Registered:
    24 Feb 2012
    02 Oct 2012
    Link to this post
    Hi,

    You can add jquery functionality to your form by assigning a unique class to your fields in the form builder:
        Open form, click the Edit button for your field
        Select the Appearance tab
        Add your unique css class and save form

     You can then add a jquery change function to the page that will display your form.  You can do this either in a master page or by adding a javascript widget to you page which is listed in the toolbox under Scripts and Styles.

    Example jquery function that will hide a field when the select field changes:

    $('.mySelectListClass').change(function()
    {
     
       $(".classOfFieldToHide").attr("style", "display: none;");
     
    });

    Thanks,

    Randy
2 posts, 0 answered