Hello again stackoverflow...
Once again I have a troublesome problem. I have a page where I am using jQuery tabs to divide up three update forms. (Two really, one is a cfgrid so it doesn't really count.) Basically, when you submit the first form tab it is fine. However, if you submit the last form, it submits and refreshes the page but nothing was updated.
I've determined it has something to do with identifying which form is being submitted.
Note: These forms are being submitted to same page they are on so I am using this method:
<cfif isdefined("form.submit")>
//database stuff etc
</cfif>
I am submitting the forms by doing this at the end:
<input type="submit" name="submit" id="button" value="Save Changes" onclick = "form.submit()" />
After determining it had something to with identifying which form is being submitted, I changed the button to be:
<input type="submit" name="submit" id="button" value="Save Changes" onclick = "document.forms["form3"].submit()" />
I'm not sure if this is the most efficient way to do this...and I'm not sure how to specific that form3 is being submitted in the coldfusion part...I tried:
<cfif isdefined("form3.submit")>
but this doesn't work. It does not follow through the code.
Note: I'm using coldfusion 8. Also, using CFAJAX tags are limited because our ITS department didn't set up coldfusion correctly on the server...and they don't believe me. Thus I'm kind forced to do it in this ...weird way. It only support cfgrid for some weird reason...
ColdFusion (nor any server-side language) does not know what ID your forms might have - it only knows what you submitted via input (and select/textarea/etc) fields, and puts it in the form scope.
To do what you want, you need to have forms somthing along the lines of:
<form>
....
<input type="submit" name="submit1" value="Save Changes"/>
</form>
<form>
....
<input type="submit" name="submit3" value="Save Changes"/>
</form>
Then on the CF side you check which form it is with:
<cfif StructKeyExists(Form,'Submit1')>
...
</cfif>
or
<cfif StructKeyExists(Form,'Submit3')>
...
</cfif>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With