ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old November 3rd, 2004, 10:55 PM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 182 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 16 h 41 m 17 sec
Reputation Power: 0
Arrow How to make drop-down required

Question i made a form that makes textboxes required and makes a popup appear if submit is hit and the textbox is empty, how do i do this same thing for drop-down menus?

Heres what im using for the textboxes.

Code:
<cfinput 
        name="Name" 
        size="9"
        required="Yes"
        maxlength="50"
        message="Please enter your name."
        value="#SESSION.Alas.Name#">


Heres what i have for the drop-down

Code:
<select name="Variable">
                 <option value="Yes">Yes</option>
                 <option value="No">No</option>
          </select>


-Alas

Reply With Quote
  #2  
Old November 4th, 2004, 07:42 AM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 182 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 16 h 41 m 17 sec
Reputation Power: 0
Ill take any ideas, "beggars can't be choosers"

Reply With Quote
  #3  
Old November 4th, 2004, 08:27 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 10 m 11 sec
Reputation Power: 42
You'll want to set a Javascript alert to fire onBlur(), which is when focus is removed from the select box.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #4  
Old November 4th, 2004, 02:35 PM
machito machito is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 34 machito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 17 sec
Reputation Power: 4
kiteless is right. You can only achieve this with JavaScript; since ColdFusion does not have, I think, the "required" atribute for drob down menus.

Reply With Quote
  #5  
Old November 10th, 2004, 01:40 PM
Drooling Dog Drooling Dog is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Salt Lake City, UT
Posts: 58 Drooling Dog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 34 m 36 sec
Reputation Power: 4
Correct. This has been a pet peeve of mine for many years now. You can do it with server-side validation, just not client-side.

For server-side, try this for your dropdown:

Code:
<select name="Variable">
   <option selected value="">Choose One...</option>
   <option value="Yes">Yes</option>
   <option value="No">No</option>
</select>


Then include this anywhere between the form tags:

Code:
<input type="hidden" name="Variable_required" value="A response to whatever is required.">

Reply With Quote
  #6  
Old November 12th, 2004, 02:26 PM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,047 Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)  Folding Points: 10114 Folding Title: Novice Folder
Time spent in forums: 1 Week 3 Days 4 h 2 m 58 sec
Reputation Power: 462
Why not use <cfeslect>? it gives you the required option and the meassage built into the object.

Reply With Quote
  #7  
Old November 16th, 2004, 01:15 AM
4thorder 4thorder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: USA MI
Posts: 40 4thorder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via ICQ to 4thorder Send a message via AIM to 4thorder Send a message via MSN to 4thorder
please clarify

I dont think I totally understand the question. The way you have that drop-down written there must be an answer of yes or no. This forces an answer. Do you want to warn if it is no?

I would add "selected" to one of the answers.

Code:
<select name="Variable" size="1">
<option value="Yes" selected>Yes</option>
<option value="No">No</option>
</select>

Reply With Quote
  #8  
Old November 16th, 2004, 02:36 PM
Bastion Bastion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 181 Bastion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 23 m 47 sec
Reputation Power: 4
Quote:
Originally Posted by Ebot
Why not use <cfeslect>? it gives you the required option and the meassage built into the object.


Ebot's right. Check out http://livedocs.macromedia.com/coldfusion/5.0/CFML_Reference/Tags91.htm

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > How to make drop-down required


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway