all groups > coldfusion flash integration > september 2005 >
You're in the

coldfusion flash integration

group:

one flash form, mulitple submit buttons


one flash form, mulitple submit buttons dpinder123
9/22/2005 7:28:18 PM
coldfusion flash integration:
I'm using the flash form tab navigator in which each tab has a different
function. Each tab has it's own submit button. The application is built into
one form, with several buttons (currently 3). Anytime I press a button on the
the second and third tabs, the app thinks that I'm trying to submit info from
the first tab (insertOrder).

Flash Forms will be the end of me today.

<!---button logic--->

<CFIF IsDefined ("FORM.insertOrder")>
<cfquery datasource="user" name="orderNumbercheck">
SELECT fileNumber FROM dbo.mortgageLog WHERE fileNumber='#FORM.fileNumber#'
</cfquery>
<cfif orderNumbercheck.RecordCount GT "0">
<cfset msg2 = URLEncodedFormat("The Order Number
<cfoutput>#FORM.fileNumber#</cfoutput>is taken, please try another")>
<cflocation url="mortgageLog.cfm?msg2=#msg2#">
<cfelse>
<cfquery datasource="datasource" name="insertOrder">
*taken out for the thread*
</cfquery>
</cfif>
<CFELSEIF IsDefined ("FORM.updateOrder")>
<cfdump var="#form#">
<CFELSEIF IsDefined ("FORM.searchOrder")>
</CFIF>

<!---buttons--->
Each button has its own name:

<cfinput type="submit" name="insertOrder" value="Submit" id="insertOrder">

<cfinput type="submit" name="updateOrder" value="Update" id="updateOrder">

<cfinput type="submit" name="searchOrder" value="search" id="searchOrder">
Re: one flash form, mulitple submit buttons Chikowski
9/23/2005 12:58:45 PM
When ever a submit button is pressed in a flash form, flash submits all the
data from all the tabs. What you may need to do is to have an on change of the
tab, call a savecontent and disable all form fields that are not on the current
tab. I usually make it a habbit to do this all the time so I am not submitting
more info than I need to.
Re: one flash form, mulitple submit buttons dpinder123
9/23/2005 9:50:15 PM
So, I guess you mean something like the code posted below? Am I correct? Do I
put this after the first tab or on the second tab? I tried on both, it didnt
work for me.

<cfformgroup type="page" label="Current Orders" width="900"
onChange="tabChanging">
<cfsavecontent variable="tabChanging">
if selectedIndex=0
form.fileNumber.enabled="false";
form.dateOrdered.enabled="false";
form.fileName.enabled="false";
form.address.enabled="false";
form.city.enabled="false";
form.state.enabled="false";
form.zip.enabled="false";
form.lender.enabled="false";
form.examiner.enabled="false";
form.notes.enabled="false";
form.dateRecorded.enabled="false";
</cfsavecontent>
Re: one flash form, mulitple submit buttons dpinder123
9/26/2005 12:00:00 AM
Thanks for clearing that up for me.

I'm now getting this error when the page loads....

There is no property with the name 'selectedindex'.
Re: one flash form, mulitple submit buttons Chikowski
9/26/2005 12:58:35 PM
What you really want is when you click on the frist tab, all the fields on the
first tab are enabled, the fields second tab and third tab are disabled. When
you click on the second tab, all the fields on the first and third tab are
disabled, all the fields on the second tab are enabled. So on and so forth.
Now to enable and disable the fields you need to use this syntax.

put the cfsavecontent either at the top of the page or include it on another
page.

<cfsavecontent variable="tabChanging">
if (selectedindex==0)
{
document.fileNumber.enabled = false;
document.dateOrdered.enabled = false;
document.fileName.enabled = false;
document.address.enabled = false;
document.city.enabled = false;
document.state.enabled = false;
document.zip.enabled = false;
document.lender.enabled = false;
document.examiner.enabled = false;
document.notes.enabled = false;
document.dateRecorded.enabled = false;
}
if (selectedindex==1)
{
document.fileNumber.enabled = true;
document.dateOrdered.enabled = true;
document.fileName.enabled = true;
document.address.enabled = true;
document.city.enabled = true;
document.state.enabled = true;
document.zip.enabled = true;
document.lender.enabled = true;
document.examiner.enabled = true;
document.notes.enabled = true;
document.dateRecorded.enabled = true;
}
</cfsavecontent>

<cfform name="myForm" format="flash">
<cfformgroup type="tabnavigator" onChange="#tabChanging#">

<cfformgroup type="page" label="Current Orders" width="900">
</cfformgroup>

<cfformgroup type="page" label="Past Orders" width="900">
</cfformgroup>

</cfformgroup>
</cfform>
Re: one flash form, mulitple submit buttons dpinder123
9/27/2005 12:00:00 AM
Ok, so what you're saying is this:

selectedIndex is used to number the tabs I have, correct? So, tab # 1 would be
selectedindex="1" and so on.....

I need to declare a variable that passes in the "if" logic:
if (variable==0)

Where "==" is specific to each tab?

so, when the user goes from form to form, the input fields on the other tabs
are disabled; correct?

so, i have to give each tab a selectedIndex number (which number should I
start at? I dont know if it works like arrays...)
and I have to declare a variable.

Right?
Re: one flash form, mulitple submit buttons Chikowski
9/27/2005 12:00:00 AM
Re: one flash form, mulitple submit buttons dpinder123
9/27/2005 12:00:00 AM
Yes, my email address is dpinder (at) titlefocus.com

Re: one flash form, mulitple submit buttons Chikowski
9/27/2005 12:48:37 PM
Re: one flash form, mulitple submit buttons somethingclever
11/11/2005 12:00:00 AM
I have a similar problem, but my solution has always been to just use "button"
instead of "submit" type and use remoting to interact with the server to
update/add/delete data.

the problem is that whenever I have a "required=yes" field, the standard error
doesn't always trigger when the field is left blank. I can't find a way to
trigger it in the actionscript. Any ideas?
Re: one flash form, mulitple submit buttons dpinder123
11/17/2005 10:45:02 PM
Re: one flash form, mulitple submit buttons sakang
1/18/2006 10:00:35 PM
Hi guys,

I am trying to do exactly the same thing with my very long form. I've been
playing with
accordion tabs, button, and flash remoting. however, I haven't been able to
get it working right. Would please share your approaches via disabling tabs
approach and button/remoting approach? You maybe my solution to my problems
I've been frustrated with. I am interested in seeing how to disable the other
tabs OR how to make the button/remoting approach work with the required fields
as well.

thanks you so much you guys!!!
AddThis Social Bookmark Button