The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

passing values through URL

Hello:

I have a text field on my page. The user needs to be able to type in some value. I then need to pass this value through an a href link to another page in a new window. This is not a submit, but just through the a href url.
Can anyone help me?

Here is what I am doing so far, but now need to replace where it says serial=serial with the value the user just typed in.
I heard something about using .value, but how do I add that using JS without using a function?
Dan

now I am trying to use the ahref to pass that value. if I use the serial_nbr var from this and then add your sLocation code after defining the var, then replace my ahref with this: <a href="#" onClick="nextPage()">your link</a>
would that do what I want it to do?

maybe that was confussing...if so please tell me what does not make sense and I will clarify.

Ok so I can pass serial numbers...Yeah!!!
But my next issue with this code is this:
i said that I had a text field...well what if I have more than one text field with the same name but with a loopcounter variable which increments the text field by one.
example
serial1
serial2
serial3...

so the JS will pass only the last serial value every time. the following is my code. I think I need to do something to relate the href link and the loopcounter variable (in JS it is i). take a look and see if you see something that may help.

so, do you want to pass the values for each textbox, everytime or do you want to pass the value for a given textbox depending on which link they click?

to answer this, I need to pass whichever textbox value is associated to that particular link.

the whole page is created in a loop. the links and textboxes are created depending on how many the user needs.
so there could be only one textbox and link or there could be up to 100.

hope this helps explain what is going on. My first thought was to create an array and add all the values into the array and pull out the value depending on which link you selected because that linke would have a loopcounter variable associated to it. Not sure if I am on the right track or if there is an easier way.

I am not totally sure what you are doing. it looks like you are creating static links? my links are within the loop so they get created within a loop dynamically. let me give you pieces of code from the loop tag and include the js code:

--setting the loop properties. form.weapon_count is the amount of weapons you are looping through--
<cfset loopcounter = "1">
<cfloop CONDITION="#loopcounter# LESS THAN OR EQUAL TO #form.weapon_count#">

It is almost perfect. I thought you were just showing me what to do. Now as you can see I commented out the for loop and the eval line and left in the line you said to use and then added an alert. the alert shows me undefined serial number. I am trying to figure out why, but thought you may see something quicker than me.
what ya think?

--added reftextbox= name with loopcounter and the id used the loopcounter variable to increment each link--
<a id="#loopcounter#" href="javascript:check_serial(this)" refTextBox="maj_asm_serial_nbr#loopcounter#"> Generate UR#loopcounter#</a> &nbsp;&nbsp;

--added id with name and loopcounter to match the reftextbox in the ahref link--

Man I can't believe it is working on your end...you are not getting an undefined for the refATag.id or the maj_asm_serial_nbr?
Crap...
Well I am heading to the families for the weekend so I will not be around to figure this out tomorrow.
I will take a look for misspellings on monday and pass along another posting if I cannot solove it.
Hope my next post is that I solved it but if not hope you can bare with me and this problem.

Thats cool that you're getting an error for both, it tells us that the reference isn't being passed correctly. make sure the the reference you're using in your interface is the same that you're using in your function. example:

this is correct:

function whatever(refReference) {
var test = refReference.value;
}

this is NOT correct:

function whatever(refReference) {
var test = referenceRef.value;
}

See what I'm saying...double check that you're not doing this by mistake.

refTextBox is set in the a href link and in the alert refATag.id, id is in the text field.
All this is undefined. I still don't see why. all the previous post show the code and this is the function above.
Also I am using the web to view this so it will display if the code is correct.
If you see anything wrong, let me know.
Also I could attatch the full page with all the info but that may be a little confusion so that is why I have not attatched it yet.

So you added the onclick instead of href?
I added the code and I got an object expected error...I am trying to debug it but not sure what may be missing. you may not be able to get that error since you may not be able to recreate the error. I will continue to try to debug. I hope this will work.