display text field based on the selection choices

Ask a Question related to ASP, Design and Development.

  1. #1

    Default display text field based on the selection choices

    I want to display credit card fields when the user selects the option paid
    membership. If user selects the option free membership, then the credit card
    text field will disappear. Here's the code I did with JavaScript but didn't
    work.

    > <SCRIPT LANGUAGE="JavaScript">
    > function generateCreditTextField()
    > { if (document.myform.membership.value == "1")
    > { alert('free');
    > document.write("");
    > }
    > else
    > { alert('paid');
    > document.write("<P>Credit Card: <input type="text"
    name="credit")</P>");
    > }
    > }
    > </SCRIPT>
    >
    > <form name="myform">
    > <select name="membership" onchange="generateCreditTextField()">
    > <option></option>
    > <option value="1">Free Membership</option>
    > <option value="2">Paid Membership</option>
    > </select>
    > </form>
    >
    > please advise! Thanks!
    > John
    >
    >





    John Davis Guest

  2. Similar Questions and Discussions

    1. Font choices in form field?
      When creating a text form field in Acrobat Pro (7) can I use any font (I have a million of them on my Mac) or does it have to be a font that would be...
    2. SQL SELECT Based on *PART* a text Field?
      Hello, I'm trying to figure out some SQL here and am wondering this: Is it possible to select data based on a sub-string of a text field? ...
    3. How to display alternate text based on dynamic data?
      I need to display alternate text based on returns from a record set. For example, when my recordset returns "21," which is a code for an employee...
    4. Changing button's URLs based upon text field
      I have created a quiz using the Coursebuilder extensions in DWMX, which puts their score in a text field on the page (no data base is used). What I...
    5. Hide text boxes based upon page selection via tab controls
      Use the Change event of the tab control. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users -...
  3. #2

    Default Re: display text field based on the selection choices

    Gazing into my crystal ball I observed "John Davis"
    <jrefactor@hotmail.com> writing in
    news:efSb2jAfDHA.164@tk2msftngp13.phx.gbl:
    > I want to display credit card fields when the user selects the option
    > paid membership. If user selects the option free membership, then the
    > credit card text field will disappear. Here's the code I did with
    > JavaScript but didn't work.
    >
    >
    >> <SCRIPT LANGUAGE="JavaScript">
    >> function generateCreditTextField()
    >> { if (document.myform.membership.value == "1")
    >> { alert('free'); document.write(""); } else
    >> { alert('paid');
    >> document.write("<P>Credit Card: <input type="text"
    >> name="credit")</P>"); } } </SCRIPT>
    >>
    >> <form name="myform">
    >> <select name="membership" onchange="generateCreditTextField()">
    >> <option></option>
    >> <option value="1">Free Membership</option>
    >> <option value="2">Paid Membership</option> </select> </form>
    >>
    >> please advise! Thanks!
    >> John
    >>
    >>
    >
    What about users without javascript?

    You could always do something put the option on page one, then test for the
    value of the option on the next page, and generate the credit card based on
    that.

    --
    Adrienne Boswell
    Please respond to the group so others can share
    [url]http://www.arbpen.com[/url]
    Adrienne Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139