?
Solved

URGENT How do I send variables when a user clicks a link without putting it in the link?

Posted on 2003-03-21
11
Medium Priority
?
262 Views
Last Modified: 2013-12-16
I have a problem where I want to send variables when the user clicks a link.  
The variables passed are the username and password so they cannot be appended to the link.  The link is in a ColdFusion page and the link is to a HTML page.  I cannot change the HTML page to ColdFusion because it is actually an InfraActive Lite HTML page.

I have heard that it is possible to send a form from the OnClick event of a link and thought this may be the way to go.  I have sort of tried but did not understand how to send a form and follow a link at the same time.

Can anyone tell me code that works to do this?
0
Comment
Question by:Miriama
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 8185838
<a href="javascript:document.forms['myform'].submit();">click here to submit the form</a>
0
 
LVL 28

Expert Comment

by:sybe
ID: 8185842
but the problem is that you require username/password to be in hidden formfields. This can be read easily from the source code.

You can not hide username/password in the source of a HTML page.

0
 
LVL 1

Expert Comment

by:spo0ky
ID: 8186709
If I've understood you right, you need to send form and to follow a link with the 1 click, then you need:

<a href="pagename.html" onclick="document.forms['formname'].submit()">click here to submit the form and to follow the link</a>
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 1

Expert Comment

by:spo0ky
ID: 8186728
or vice versa :)

<a href="javascript:document.forms['formname'].submit()" onclick="document.location.href = 'pagename.html'">click here to submit the form and to follow the link</a>
0
 
LVL 1

Expert Comment

by:spo0ky
ID: 8186729
or vice versa :)

<a href="javascript:document.forms['formname'].submit()" onclick="document.location.href = 'pagename.html'">click here to submit the form and to follow the link</a>
0
 
LVL 1

Expert Comment

by:spo0ky
ID: 8186788
sorry, use window.location.href=, but not document.location.href=.
0
 

Author Comment

by:Miriama
ID: 8187971
You will probably think I am an idiot but what is the code to display these variables on 'pagename.html' in a text field?  I don't understand why everything I am trying is not working.

Also do you know if it is possible to pick up the username and password from the ColdFusion session variables before submitting the form so these variables are not stored in hidden variables on the page?
0
 

Author Comment

by:Miriama
ID: 8188006
You will probably think I am an idiot but what is the code to display these variables on 'pagename.html' in a text field?  I don't understand why everything I am trying is not working.

Also do you know if it is possible to pick up the username and password from the ColdFusion session variables before submitting the form so these variables are not stored in hidden variables on the page?
0
 
LVL 1

Expert Comment

by:spo0ky
ID: 8189123
If I understood you clearly, you need to display some information in the text field, then use this script:

document.forms[formName/formIndex(0-..)].textfieldName.value = "something here"

As for the socond question, sorry, but I've never used ColdFusion and I'm absolutely null in cgi, php and databases.
0
 
LVL 3

Accepted Solution

by:
Adelphi earned 700 total points
ID: 8204570
Miriama,
The ways to submit a form and follow a link are right, but are not really a solution for your scenario.

I'm assuming that the user logged in on another page and that you have retained username and password in session variables for your other CF pages.

So, the ways to send previously-acquired data to another page is:
1. append to URL (not good for password!)
2. submit via a form w/hidden fields (still not good for password)
3. session variables
4. cookies
5. store in database

We've established that 1 & 2 are not secure.  On 3, CF session variables will not pass to an external HTML page (I'm assuming you do not have control over the HTML page).  I think the only other way to do this is to write a cookie that is read by the HTML page.

Finally, you asked how to display variables in a text field.  Do you mean that you need to send the username and password to the HTML page and THEN have them show up as editable fields there?  If so, then try:
<input type="text" name="userName" value="[variablename].value">

Where [variablename] is the code required to place that variable name there.  This will vary depending on what coding language you will be using on that HTML page.
0
 

Author Comment

by:Miriama
ID: 8451525
Sorry didn't get back to you earlier.
Thankyou for your clear explanation of the best way to do it.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question