Link to home
Start Free TrialLog in
Avatar of BuMp
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=#qClient.ID#" ONCLICK="document.all('app1').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?
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BuMp
BuMp

ASKER

I found a way to use <input name="name" type="image"> for the submit and then in the action page check if form.name.x is defined or not, if so go to that page, and so on for all input types.  That way requires images for the submit button and works good as well.  I will try your way using links like i initially wanted tomorrow morning.  Thanks for the comment.
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>
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.action='fullapp2.cfm?ID=#qClient.ID#';document.app1.submit();">Property & Loan Info</a>
</BODY>
</HTML>


for image

</HEAD>
<BODY>
<FORM action="" method=POST name="app1">
</FORM>
<a href="#" onClick="document.app1.action='fullapp2.cfm?ID=#qClient.ID#';document.app1.submit();"><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='#qClient.ID#';document.app1.submit();">Property & 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='#qClient.ID#';document.app1.submit();"><img src="" name="img" border="0"></a>
</BODY>
</HTML>

Regards..
Hart

Avatar of BuMp

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
Avatar of BuMp

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
Grade changed as requested

Computer101
E-E Admin
Thanks to all,

Fritz the Blank