ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Clickatell
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 May 21st, 2004, 11:24 AM
sunbigsmile sunbigsmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 27 sunbigsmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question required and message attribute


I can't figure out what problem I have. I put the exact syntax for cfinput as following:
<cfinput type="text" name="city" size="30" required="yes" message="you have to enter a city">
and
<cfselect query="display_price_range" name="min" display="price" value="price" required="yes" message="give me a min price."><option value="" selected>Minimum Price</option></cfselect>

and

<cfselect query="display_price_range" name="max" display="price" value="price" required="yes" message="give me a max price"><option value="" selected>Max Price</option></cfselect>

When I tested it, I left all those fields blank. The page doesn't show me a little pop up window displaying the message. But instead it went to next page with an error page that who works with coldfusion often sees when there is an error. Does anyone know how to make it show the message and kind of stop going to next page until user enters something in the required fields?

By the way, I created a table stores price values so that I can use it in list box. I made the price field in price_range as currency data type. However, when it showed online, each item -price, has 4 zeros after dot. Then I put 0 in the field said number after decimal places. It still did not work. Does anyone know why?

Reply With Quote
  #2  
Old May 21st, 2004, 12:33 PM
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
This code works for me, so I'm not sure what you are doing wrong:

<cfform action="page2.cfm" method="POST">
<cfinput type="text" name="city" size="30" required="yes" message="you have to enter a city">
<input type="submit" name="fff" id="fff" value="fff">
</cfform>
__________________
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
  #3  
Old May 21st, 2004, 12:38 PM
sunbigsmile sunbigsmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 27 sunbigsmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I did as what you showed me. But it failed.
Thanks anyway. IF you know what caused the problem, please let me know.

Reply With Quote
  #4  
Old May 21st, 2004, 01:16 PM
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
I don't understand. You're telling me that you can copy the above code, paste it into a blank .cfm file, save it, and run it, and if you leave the select field blank and press submit, you do not get a Javascript alert that says "you must enter a city"?

Reply With Quote
  #5  
Old May 25th, 2004, 09:17 AM
sunbigsmile sunbigsmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 27 sunbigsmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
yes, exactly. That's why I don't understand.

Reply With Quote
  #6  
Old May 25th, 2004, 10:20 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
Can you paste the exact code that you are running so that I can see it? And what happens when you run it, do you get an error, or does nothing happen? Do other .cfm pages run correctly?

Reply With Quote
  #7  
Old May 25th, 2004, 10:28 AM
sunbigsmile sunbigsmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 27 sunbigsmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<cfform action="next.cfm" method="post">
ID: <cfinput type="text" name="ID" validate="integer" required="yes" message="you have to give a number" >
<input type="submit" name="s_mit" value="submit">
</cfform>

Here is the code. If I didn't put anything in the form field, it will say next.cfm is not found. If I put something in there, then the page next.cfm runs fine.
Thanks

Reply With Quote
  #8  
Old May 25th, 2004, 10:33 AM
sunbigsmile sunbigsmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 27 sunbigsmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Oh, I am sorry the error message is not "file not found" but it is something like this: missing operator [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='.

The error occurred in C:\Websites\next.cfm: line 11

9 : select ID
10 : from table_name
11 : where ID = #form.ID#
12 : </cfquery>
13 : <cfif validate_account.recordcount EQ 0>
:
:
:
:
I used this ID form control to validate ID in the table.
This is all I used it for. Thanks

Reply With Quote
  #9  
Old May 25th, 2004, 03:07 PM
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
I can take that code and paste it into an empty .cfm file and run it, and if I leave the field blank and press enter then I get a Javascript alert box telling me "you have to give a number".

So there is definitely something wrong on your end, either you have Javascript disabled in your browser or something else in the page is interfering in the execution of the Javascript.

Reply With Quote
  #10  
Old May 26th, 2004, 09:31 AM
sunbigsmile sunbigsmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 27 sunbigsmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi
Thank you again. I have a question, do I have to include this code in order for it to show the javascript?
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
//-->
</script>
By the way, I discovered that I used the required and message attributes in several pages. Some of them works which means the javascript window shows the message. Some of them doesn't. I found out that the list box doesn't work, only the text box form control works.
Do you have any comment?

Last edited by sunbigsmile : May 26th, 2004 at 09:37 AM.

Reply With Quote
  #11  
Old May 26th, 2004, 10:40 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 don't have to put any Javascript in your page, CF generates it automatically.

I am not sure why some of the alerts work and some don't, but I am pretty sure that it must be some conflict on your page that is causing some of the alerts to fail. Confirm that you have different form field names (and corresponding form field id values) for each form element. Then try running only one or two form fields at a time until you determine which one or which combination is causing the problem.

I should note that I'm not deeply familiar with using CFFORM as I hate it and prefer to write my own validation code.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > required and message attribute


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