Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    i wish to show/appear and dissappear text box based on a the drop down item selected.

    i wish to show/appear and dissappear text box based on a the drop down item selected.

    what do i have to add to the code below.? div?


    under Comm_DEV
    drop down selection.

    if CELL_Phone then CELL_Phone text box shows/appears
    if pager_device then CELL_Phone text box dissappears.

    if email_Address only is selected then pager_device and CELL_Phone dissappears otherwise JOB_email_Address is shown ( even if CELL_Phone or pager_device is selected JOB_email_Address still appears)

    Thank you
    n
    thanks in Adv
    <!---------------------------------------------->
    the field Comm_DEV gets populated with "E","CE","PE" when it is submit
    when selected from the drop down.
    <table>
    <tr>
    <td>Comm_DEV </td>
    <td>
    <SELECT name="Comm_DEV" size="1">
    <OPTION Value = "EM">Please Select</OPTION>
    <OPTION Value = "CE" <cfif Comm_DEV is "CE">selected</cfif>>CELL_Phone</OPTION>
    <OPTION Value = "EM" <cfif Comm_DEV is "EM">selected</cfif>>email_Address Only</OPTION>
    <OPTION Value = "PE" <cfif Comm_DEV is "PE">selected</cfif>>pager_device</OPTION>
    </select> <!--------------------------></td>
    </tr>
    <!------Here are the text boxes to appear or dissapear CELL_Phone and JOB_email_Address-------------------->
    <tr>
    <td>CELL_Phone</td>
    <td><cfoutput>
    <cfif NOT len(trim(device_email_Address))><cfset device_email_Address = "@cingularme.com"></cfif>
    <input type="Text" name="Device_email_Address" value="#Device_email_Address#" size="40" maxlength="40"> </td>




    <td>
    <b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">JOBemail_Address</font></b><br>
    <cfif not len(trim(JOB_email_Address))><cfset JOB_email_Address = "@balbal.org"></cfif>
    <input type="text" name="JOB_email_Address" Value="#JOB_email_Address#" size="40"><br><br>
    </cfoutput></td>
    </tr>


    </table>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    In short, device address field will only show if "CELL_Phone" is selected, otherwise it will be hidden, right? And job email address is always shown regardless of the selected option?

    Code:
    function showHideField(sel){
      var da = document.getElementById("deviceAddr");
      da.style.display = (sel.value=="CE") ? "":"none";
    }
    Code:
    <SELECT name="Comm_DEV" size="1" onchange="showHideField(this)">
    <OPTION Value = "">Please Select</OPTION>
    <OPTION Value = "CE" <cfif Comm_DEV is "CE">selected</cfif>>CELL_Phone</OPTION>
    <OPTION Value = "EM" <cfif Comm_DEV is "EM">selected</cfif>>email_Address Only</OPTION>
    <OPTION Value = "PE" <cfif Comm_DEV is "PE">selected</cfif>>pager_device</OPTION>
    </select>
    ...
    <tbody id="deviceAddr">
    <tr>
    <td>CELL_Phone</td>
    <td><cfoutput>
    <cfif NOT len(trim(device_email_Address))><cfset device_email_Address = "@cingularme.com"></cfif>
    <input type="Text" name="Device_email_Address" value="#Device_email_Address#" size="40" maxlength="40"> </td>
    </tr></tbody>
    Let me know if my understanding is not correct.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanks but also pager should be visible when it is checked.

    Glenn
    does this also work if
    also pager should be visible when it is selected otherwise invisble.
    do i put this part:


    function showHideField(sel){
    var da = document.getElementById("deviceAddr");
    da.style.display = (sel.value=="CE") ? "":"none";
    }


    in the head or body?





    What happen to the rest of the code like if it was a pager ? selection?

    thanks
    Last edited by CFstudent; 06-20-2007 at 07:10 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •