Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit a form via CF 1

Status
Not open for further replies.

LarrySteele

Programmer
May 18, 2004
318
US
I have a page that processes data and looks for changes. If changes are detected, they appear in a table. Otherwise, the page displays a message that there are no changes, and the users have a submit button to navigate to the next page.

What would be nice is if I could have ColdFusion submit the form automatically if there are no changes. The result is that the difference table appears if there are changes, otherwise the site navigates straight to the next page.

I tried cflocation, but I need the form variables posted. Hence, my desire to have CF *submit* the form.

This change is not important. Currently the process works and works well. I'd just like to save the step of clicking a button (when I don't otherwise need to).

TIA,
Larry
 
One option is to pass the values as url parameters instead of form variables. That would allow you to use cflocation. Another option is to use javascript to automatically submit the form, but preserve the "submit" button in case the user has disabled javascript.


Code:
Psuedo-code
<cfif ThereAreNoChanges>
   <script type="text/javascript">
       var frm = document.getElementById('yourFormId');
       frm.submit();
   </script>
</cfif>
 
Thanks for the suggestions. With very few exceptions, I'm posting variables.

I tried your pseudo-code and it worked just fine. I should have been able to figure that one out. I guess I've been switching between too many languages recently. I've definitely been spending more time on the mainframe than I like.

Cheers,
Larry

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top