Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Nov 2006
    Posts
    9
    Member #
    14398
    I need to build a web form that is somewhat dynamic in that it's an Admissions application. What I want to make dynamic is if an applicant chooses one thing, it gives them a certain set of questions to answer than if those made a different selection. In the end, I'll need the form to output the data to a text file on the web server.
    The form itself I don't have a problem with but the need for a certain amount of dynamicness has me lost. I'm assuming this would need to be done somehow with a javascript but need a helping hand.
    How would I do this?
    Thanks!

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    You would put different parts of the forms into a div and change the visible property according to your logic.

  4. #3
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    To do it with Javascript, you can have a show/hide div act on an onBlur... this is best done with some sort of select or radio button so it's a simple name/value pair to match.

    For example (inline styling is to demonstrate behavior, though it is still better practice to have an external style sheet), if you wanted to ask women if they are pregnant:

    HTML Code:
    <script type="text/javascript">
    askPregnant = function() {
      document.getElementById('pregnant').display = 'block';
    }
    </script>
    
    <div id="gender">
      <label for="gender">Gender:</label>
      <input type="radio" name="gender" value="M" /> Male
      <input type="radio" name="gender" value="F" onBlur="askPregnant();" /> Female
    </div>
    
    <div id="pregnant">
      <label for="pregnant" style="display: none;">Are you pregnant?</label>
      <input type="radio" name="pregnant" value="Y" /> Yes
      <input type="radio" name="pregnant" value="N" /> No
    </div>
    Shani

    I have an eye for detail like you'd never believe.

  5. #4
    Junior Member
    Join Date
    Nov 2006
    Posts
    9
    Member #
    14398
    That code doesn't seem to work. However, an example of this nature would be great. Possibly an example where if they choose female, it asks "are you pregnant", with answers of yes or no. If they choose male, "is your signficant other pregnant" with answers of yes, no or I'm not sure.
    Thanks!
    Buster


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:34 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com