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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfselect

Status
Not open for further replies.

Cold

Technical User
Feb 19, 2002
6
US
Hi everybody,

I have a problem with <cfselect> in my cfform.
The advantage of using cfforms is that u can popup messages once nothing's been fillen in a formfield.
But when does that happen with <cfselect>?
You can optionally make the field required and fill in your popup message, but everytime i submit my form nothing's being popped up!
I tried everything!
eg
<cfselect name=&quot;name&quot; message=&quot;select this field!&quot; required=&quot;Yes&quot;>
<option value=&quot;&quot;></option>
<option value=&quot;first option&quot;>one</option>
<option value=&quot;second option&quot;>two</option>
<option value=&quot;third option&quot;>three</option>
</cfselect>

Can someone please help me out? tnx

 
Hi,

I had the same problem to solve. I had to use Javascript.
For that reason I had to use 'select' instead of 'cfselect'.
1) function in Javascript :
<head>
<script language=&quot;JavaScript&quot;>
function check_form(){
if (document.forms[0].SelectName.options[document.forms[0].SelectName.selectedIndex].value == '') {
alert('Message');
return(false);}}
</script>
</head>

2) Select:
<select name=&quot;SelectName&quot; >
<option ></option>
<option value=&quot;first option&quot;>one</option>
<option value=&quot;second option&quot;>two</option>
<option value=&quot;third option&quot;>three</option>
</select>

3) Validation when submit:
<INPUT type=&quot;submit&quot; name=&quot;FormName&quot; value=&quot;Insert&quot; onclick=&quot;return(check_form());&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top