?
Solved

Hi! how do i use the hidden field in <form></form> to make a field required?

Posted on 2004-08-19
5
Medium Priority
?
132 Views
Last Modified: 2013-12-24
Hi,

how do i use the hidden field in <form></form> to make a field required?

I was thinking of using hidden field so it will prompt the user that it is required.

This is what i have

<input type="hidden" name="CUlast_required">
  <input type="hidden" name="CUfirst_required">
  <input type="hidden" name="CULogin_required">
  <input type="hidden" name="CUPass_required">
  <input type="hidden" name="CUDeptID_required">
  <input type="hidden" name="CUserRoleid_required">


Do I have to include anything in my <input type="text" name="CUlast" id="CUlastAdd" size="15" maxlength="20">

Thanks
0
Comment
Question by:mdbbound
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 11848979
<cfinput
   type = "Text" name = "MyPhone"
   message = "Enter telephone number,formatted xxx-xxx-xxxx (e.g. 617-761-2000)"
   validate = "telephone" required = "Yes">
   <font size = -1 color = red>Required</font>

This is one of the example.
Though you will have to use <cfform></cfform>
now looking at your example:
<cfinput type="text" name="CUlast" id="CUlastAdd" size="15" maxlength="20" message="please enter this id" required = "YES">

This will work. There is one more way to do this also. I will post it soon.
Personally I do not like to use <cfform> do not know why? Smile.
Regards,
---Pinal
0
 
LVL 21

Accepted Solution

by:
pinaldave earned 2000 total points
ID: 11849001
Hi mdbbound,

http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/formatData8.htm

<input type="text" name="CUlastAdd" id="CUlastAdd" size="15" maxlength="20">
<input type="hidden" name="CUlastAdd_required"       value="You must enter a data.">

This will work if you are not using CFFORM and CFINPUT

You can have wonderful referance at the site I mentioned on the top.
Hope this helps,
Regards,
---Pinal
0
 
LVL 17

Expert Comment

by:anandkp
ID: 11849536
if ur asking for HTML validations - u have the answer above.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11853501
In general it is better to write your own validation and not have CF generate code to make required fields as the generated code is not very good nor very user friendly...
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11959138
hello Mdbbound,
Thank you again,
Good Day buddy,
---Pinal
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
What You Need to Know when Searching for a Webhost Provider
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question