|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
ASP or HTML? to verify selection
I have a webpage where there are two drop down menues. From each of them, one item can be selected. I need code to test if there was an item selected from both the drop down menus. How do I do this? Do use ASP or HTML? Any help would be great. Thanks.
|
|
#2
|
|||
|
|||
|
if you're doing a validation of checking to make sure that they are selected you'll need to use javascript.
ASP is server side so if you submit to whatever form, when you submit you can make sure that d1.value<>"" and make sure d2.value<>"" |
|
#3
|
|||
|
|||
|
what code do I need exactly to use the d2.value<>"" command? I mean what exactly do i need to enter?
|
|
#4
|
|||
|
|||
|
I don't know, you're the one doing the validating, i'd need to know the set up or what you'd want to do, maybe redirect back to the form if they didn't enter it correctly with querystring response?
<% if (d1.value="" or d2.value="") then response.redirect "form.asp?validate=no end if %> then in your original form if querystring validate=no then display a div stating that you didn't enter correctly.... the common practice is javascript though really. |
|
#5
|
|||
|
|||
|
Thanks for that. This is what I am working with. This is the drop down menu on the first page:
<form method="POST" action="results1.asp"> <p>Select a Variable:</p> <p><select size="1" name="Variable"> <option>Amount of Dollars</option> <option>Amount of Hours</option> <option>Number of Tickets</option> </select></p> </form> Then on the second page: I have this to make it appear: <% Dim sOutput sOutput = Request.Form("variable") Response.Write(sOutput) %> I need to make sure one of the values is selected from that drop down menu. |
|
#6
|
|||
|
|||
|
Do something with javascript in this case....
Code:
<form onSubmit="return validate()">
<script>
function validate()
{
submitOK="True";
var message = "Form incomplete:\n";
if (document.Variable.value.length<1)
{ message += "Drop Down Menu.\n";
submitOK="False"; }
if (submitOK=="False")
{
alert(message)
return false;
}
else
{
return true;
}
</script>
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > ASP or HTML? to verify selection |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|