BuMp
asked on
Need links to submit form AND pass a value
Hi, I am using Coldfusion and have form page post to action page with submit button. I also have navigation links because form is 5 pages. I want the links to also submit to the. The action page needs a url location after the database update or nothing happens after the udpate. So I have a cflocation url="#" to say to go to next page. I want to have cfif's say if #url.page# is 1 goto this page and so on. I know thats all coldfusion but the part im missing i think needs to be java. I have tried onclick submit which works, but I cant get it to pass a url variable or pass a form variable. This is one link:
<a href="fullapp2.cfm?ID=#qCl ient.ID#" ONCLICK="document.all('app 1').submit (); return false;">Property & Loan Info</a>
That does go to the action page when the link is clicked, but because I have the action page url location, that overrides the href here. If I dont have url location in the action page, this href location doesnt go anywhere. So pretty much anything i put in href is useless. I dont care how its done, i just want a link to be able to run the action page (update the database) and then go to the chosen link. Any ideas?
<a href="fullapp2.cfm?ID=#qCl
That does go to the action page when the link is clicked, but because I have the action page url location, that overrides the href here. If I dont have url location in the action page, this href location doesnt go anywhere. So pretty much anything i put in href is useless. I dont care how its done, i just want a link to be able to run the action page (update the database) and then go to the chosen link. Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is a typo above, I forgot to include the closing brace for the function. It should be:
<SCRIPT LANGUAGE=javascript>
<!--
function setFormAction(strURL){
document.forms[0].action = strURL;
document.forms[0].submit() ;
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript>
<!--
function setFormAction(strURL){
document.forms[0].action = strURL;
document.forms[0].submit()
}
//-->
</SCRIPT>
I am not overwritting fritz_the_blank 's suggestions.
they are perfect.
i am just giving examples of both image and link..
For link
</HEAD>
<BODY>
<FORM action="" method=POST name="app1">
</FORM>
<a href="#" onClick="document.app1.act ion='fulla pp2.cfm?ID =#qClient. ID#';docum ent.app1.s ubmit();"> Property & Loan Info</a>
</BODY>
</HTML>
for image
</HEAD>
<BODY>
<FORM action="" method=POST name="app1">
</FORM>
<a href="#" onClick="document.app1.act ion='fulla pp2.cfm?ID =#qClient. ID#';docum ent.app1.s ubmit();"> <img src="" name="img" border="0"></a>
</BODY>
</HTML>
The above two examples will show the id in the url. And this can be fiddled by the end user so i would suggest that you keep an hidden field called id
i.e
For link
</HEAD>
<BODY>
<FORM action="fullapp2.cfm" method=POST name="app1">
<input type="hidden" name="ID" value="">
</FORM>
<a href="#" onClick="document.app1.ID. value='#qC lient.ID#' ;document. app1.submi t();">Prop erty & Loan Info</a>
</BODY>
</HTML>
For image
</HEAD>
<BODY>
<FORM action="fullapp2.cfm" method=POST name="app1">
<input type="hidden" name="ID" value="">
</FORM>
<a href="#" onClick="document.app1.ID. value='#qC lient.ID#' ;document. app1.submi t();"><img src="" name="img" border="0"></a>
</BODY>
</HTML>
Regards..
Hart
they are perfect.
i am just giving examples of both image and link..
For link
</HEAD>
<BODY>
<FORM action="" method=POST name="app1">
</FORM>
<a href="#" onClick="document.app1.act
</BODY>
</HTML>
for image
</HEAD>
<BODY>
<FORM action="" method=POST name="app1">
</FORM>
<a href="#" onClick="document.app1.act
</BODY>
</HTML>
The above two examples will show the id in the url. And this can be fiddled by the end user so i would suggest that you keep an hidden field called id
i.e
For link
</HEAD>
<BODY>
<FORM action="fullapp2.cfm" method=POST name="app1">
<input type="hidden" name="ID" value="">
</FORM>
<a href="#" onClick="document.app1.ID.
</BODY>
</HTML>
For image
</HEAD>
<BODY>
<FORM action="fullapp2.cfm" method=POST name="app1">
<input type="hidden" name="ID" value="">
</FORM>
<a href="#" onClick="document.app1.ID.
</BODY>
</HTML>
Regards..
Hart
ASKER
Thanks to both of you for your comments, either way works good but will reward points to the first answer.
Any reason for the grade of B, then?
Fritz the Blank
Fritz the Blank
ASKER
Sorry, i just saw "good" and chose that, didnt think of it as an a,b or c thing. If i can change it let me know.
Yes, please post a question worth 0 points here requesting the change:
https://www.experts-exchange.com/Community_Support/
If you include the URL for this question in the body, they can take care of it.
Thank you,
Fritz the Blank
https://www.experts-exchange.com/Community_Support/
If you include the URL for this question in the body, they can take care of it.
Thank you,
Fritz the Blank
Grade changed as requested
Computer101
E-E Admin
Computer101
E-E Admin
Thanks to all,
Fritz the Blank
Fritz the Blank
ASKER