I'm an ASP guy who recieved a request to build a ColdFusion application. Problem: I have several buttons on a form (options). Each button will submit the form to the same page but, based upon which button has been clicked, a different query will be triggered. For some reason ColdFusion will not pass the values of the buttons to the recieving page for evaluation. Does anyone know if this is possible? Been to the CF Forums and no bites. Thanks.
Are using cfform of just a regular form? Can you post some code?
Using standard HTML form. Since CF is new to me I'm trying to avoid using it as much as possible. Should I be using CFFORM?
Can't post the actual code right now, still in the midst of testing but here is the basic's of what I'm trying to accomplish:
<cfif IsDefined("Form.button1")>
do this.....
<cfelseif IsDefined("Form.button2")>
do this....
<cfelseif IsDefined("Form.button3")>
do this...
<cfelse>
do this...
</cfif>
Then try just a
<cfoutput>#form.button1#</cfoutput>
If it is returning the right value then you may need to modify your <cfif> statements. I do not have a cf server at work so I can not test your code.
aandrew,
Sorry for the bad info. Your form does not pass the button value at all. I do not know if that is a html or cfm issue. I added a hidden field to set whatever value you are trying to pass. I also used the cfswitch instead of cfifs. Hope this helps.
<html>
<head>
<script language="JavaScript">
function submitIt(v)
{
document.frmTest.hdnAction.value = v;
document.frmTest.submit();
}
</script>
</head>
<cfif isdefined("form.hdnAction")>
<cfswitch expression="#hdnAction#">
<cfcase value="Uno">
Script One
</cfcase>
<cfcase value="Dos">
Script Two
</cfcase>
<cfcase value="Tres">
Script Three
</cfcase>
<cfdefaultcase>
No Script
</cfdefaultcase>
</cfswitch>
</cfif>