Dynamic ASP form - prevent user choosing default.

I

iam247

Hi

I have a dynamic ASP form which only includes an option list. The list
is dynamically created but includes a default value "Select a group".
The code is shown at bottom.

I want to ensure the user does not submit the form with the default
value selected.

I think something like the javscript handler available at:
http://www.devx.com/tips/Tip/13767 might be what I need.

(script extract)

<SCRIPT>
function checkvalue() {
if (triviaform.TriviaAnswer.options[0].selected) {
alert('You must enter your response.');
event.returnValue=false;
}
}
</SCRIPT>

However this script works for a static form with pre numbered options
ie option 0 is the default option.

How do I modify this script (or get another one) which will prevent my
default value being selected?

Thanks ColinK

MY FORM

<form action="LeaderSelect2.asp" method="get">
<select name="GroupName">

<option>Select a Group</option>

<%
' Continue until we get to the end of the recordset.
Do While Not rsGroupP.EOF
' For each record we create a option tag and set it's value to the
GroupID

%>
<option value="<%= rsGroupP.Fields("GroupName") %>"><%=
rsGroupP.Fields("GroupName") %></option>
<%
' Get next record
rsGroupP.MoveNext
Loop

End If
%>
<input type="submit" name="Submit" value="Add a Leader to this
Group">
</form>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top