Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a new textbox to a Form. 1

Status
Not open for further replies.

Castanz

Programmer
Apr 5, 2002
61
US
Hi everyone. Having some problems with this form. There should be a Javascript solution, but I can't find the answer:

I want a form that prompts the user for a specific date if they choose a certain option(Meals on a specific date) from a drop down list.

This is what I have so far.

Code:
<form name="GetOrderChoice" action="glist.asp" method="post">
  <p></p>
  <p> 
<p><font SIZE="5">Enter your preference of report: <select Name="OrderChoice" size="5" onFocus="if (this.value = "InputDate") document.getElementById('ReportDate').Type=text; else  document.getElementById('ReportDate').Type=hidden;">
  <option Value="bydate">All Pending Meals </option>
  <option Value="InputDate">Meals on a specific date.</option>
  <option Value="TomorrowsMeals">All of Tomorrow's meals.</option>
  <option Value="ByName">Listing by service member's name. </option>
  <option Value="AllRecords">All Records old and new. </option>
</select></font>
<p>
<input type="Hidden" name="ReportDate" Value="repdate" length=20>

    <input type="submit" name="submitbutton" value="Submit">
</form>

I tried to hide the text box then un-hide it if the user chooses "Meals on a specific date"

Any suggestions would be appreciated.
 
There should be a Javascript solution
So, why posting in the VBScript forum ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
[1]
><input type="Hidden" name="ReportDate" Value="repdate" length=20>
[tt]<input type="[red]text[/red]" name="ReportDate" [red]id="ReportDate"[/red] [red]v[/red]alue="repdate" length=[red]"[/red]20[red]"[/red] [blue]style="display:none"[/blue]>[/tt]

[2]
><select Name="OrderChoice" size="5" onFocus="if (this.value = "InputDate") document.getElementById('ReportDate').Type=text; else document.getElementById('ReportDate').Type=hidden;">
[tt]<select [red]n[/red]ame="OrderChoice" size="5" on[red]change[/red]="if (this.value [red]==[/red] "InputDate") document.getElementById('ReportDate').[red]style.display[/red]=[red]'block'[/red]; else document.getElementById('ReportDate').[red]style.display[/red]=[red]'none'[/red];">[/tt]
 
Amendment
[2'] Forgotten to edit out the quote on InputDate, this is the retake.
[tt]<select name="OrderChoice" size="5" onchange="if (this.value == [red]'[/red]InputDate[red]'[/red]) document.getElementById('ReportDate').style.display='block'; else document.getElementById('ReportDate').style.display='none';">[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top