Think I figured it out the first part using the cf_field_validation tag.
Pretty neat!
The only problem is that I want to call two javascript functions from the
same onsubmit call--due to the fact that I have two separate loops running
in order to serve up two parts of the dynamic form.
What's the proper format to use when calling multiple javascript functions
from the same form?
This doesn't seem to work:
<CFFORM
ACTION="pv_post.cfm?sa=2&stid=4&scid=8&p=post_insert&pt=post_insert&cid=#cid
#" method="post" NAME="addcase" onsubmit="return state();return state_2();">
<INPUT type="submit" name="insert" value="Continue »" onclick="return
state();return state_2();">
It does work however with the first set of "state" javascript checks....but
the "state_2" checks do not get executed.
This is so dumb, but what can I call to get both "state" and "state_2"
javascript functions to get executed once the user clicks the submit button?
Thanks a ton,
BW
----- Original Message -----
From: "Mark Warrick" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, May 29, 2001 7:15 PM
Subject: RE: Silly Validation Question...
> Brandon,
>
> The solution to the problem is to NOT use CFFORM for validation. Use
> roll-your-own JavaScripts instead. You'll have far greater flexibility.
>
> Here's an example of how I was able to make sure a state was selected in a
> form:
>
>
> -----------------snip-------------------------------
> <script language="JavaScript"><!--
> function validate(form) {
> if (form.state_code.selectedIndex == 0) {
> alert('Please select a state.');
> return false;
> }
> return true;
> }
> //--></script>
>
>
> <cfparam name="state_code" default="">
>
> <cfif state_code neq "">
>
> <cfoutput>
> #state_code#
> </cfoutput>
>
> </cfif>
>
> <CFQUERY NAME="get_states" DATASOURCE="zapconnect_com_sql">
> SELECT STATE_CODE, STATE_NAME
> FROM STATES
> ORDER BY STATE_NAME
> </CFQUERY>
>
> <cfoutput>
> <form action="#script_name#" onSubmit="return validate(this)">
> <select name="state_code">
> <option value="">Select a State:
> </cfoutput>
>
> <cfoutput query="get_states">
> <option value="#state_code#">#state_name#
> </cfoutput>
>
> </select>
> <input type="submit" value="Submit">
> </form>
>
> ------------------------snip---------------------
>
> ------------------------------------
> Mark Warrick - Fusioneers.com
> Email: [EMAIL PROTECTED]
> Phone: 714-547-5386
> http://www.fusioneers.com
> http://www.warrick.net
> ====================================
>
> > -----Original Message-----
> > From: Brandon Wood [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 29, 2001 2:13 PM
> > To: CF-Talk
> > Subject: Silly Validation Question...
> >
> >
> > Hey,
> >
> > Does anyone have a good script or method of making a select box contain
a
> > value other than ""?
> >
> > I am working on a state drop-down in which the first selection is "Pick
> > State" with a value of "".
> >
> > What I want to happen is for a javascript screen to pop up (or something
> > like that--you know the usual CFFORM javascript validation) if a
> > user tries
> > to submit the form without choosing a state that has a value. I
> > have seenm
> > this used many times and even with CFSELECT form fields, but I am
> > having the
> > worst time trying to implement this.
> >
> > I want to populate the CFSELECT with a query from a State_Table but do
not
> > want to store a state with a value of "" as not to populate a state
field
> > with NULL answer.
> >
> > Is there an OnError or someother Javanscript function that could make
sure
> > that a value other than "" was chosen and that the error message could
be
> > configurable. I know that this is so CF 101, but I have never had to do
> > this and am pulling my hair out in anger.
> >
> > Thanks a ton,
> > BW
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists