Skip to main content
Participant
July 14, 2009
Question

Conditional Text boxes

  • July 14, 2009
  • 2 replies
  • 1567 views

I am attempting to add a conditional text box on a form on my website.  For example, if the user answers "No" to an item, I would like for an additional text box to appear to allow the user to enter comments for selecting no.  My forms then are sent to a mailbox for processing, so I would need to be able to have this information be able to be sent to with the email as well.  Is this possible?

I am also looking for code that would allow me to enter additional line items on a form.  So for example my form has a base of 5 lines for the user to enter data into.  Sometimes they may need more than 5 lines, I would like for them to be able to click a button to add additional lines.  I would need for these additional lines.

Thanks

Jeff

    This topic has been closed for replies.

    2 replies

    Participating Frequently
    July 14, 2009

    Hi jeff

    For

    "

    I am also looking for code that would allow me to enter additional line items on a form.  So for example my form has a base of 5 lines for the user to enter data into.  Sometimes they may need more than 5 lines, I would like for them to be able to click a button to add additional lines.  I would need for these additional lines."

    you can tweak the follwing code and use it as appropriate

    <script type="text/javascript" language="javascript">
    function txtenlarge()
    {

    document.getElementById("txtin").rows = 10;
    }
    </script>

    <form action="test.cfm" name="testform">
    <textarea rows="5" name="txtin" id="txtin"></textarea>
    <input type="button" onclick="txtenlarge()" />
    </form>

    Participant
    July 14, 2009

    I don't think I was clear in my description of what I am doing.  I have a form right now that has a table on it that currently has 5 rows in the table where the users can submit requests.  I want the users to be able to add line items to the table if they have more than 5 items to submit at one time.  Right now they would need to submit the first 5 and then go back and submit the next 5. Thanks Jeff

    Participating Frequently
    July 14, 2009

    Hi Jeff

    Regarding conditional text box :

    You can either use js function to hide and display the text box according to the value of the 1st text box . For that you have to call the function depending on the event like "onKeyUp". Another good solution is the usage of cfdiv .