Auto Filled in Fields of a form?

liunx

Guest
I am creating a form for users to register for seminars. I have a field which they can write what seminar they would like to register for, but on a page which lists the available seminars, they can click on a "resgiter now" link, which sends them to the page with the form. <br />
<br />
What I was wondering is if I can have the seminar field already filled in for them depending on which link they clicked on. So it must recognize which link was clicked. I was trying to pass parameters in the URL by adding the ?parameter_name after the url. But I wasnt sure how to set the value of the text field so that it displays the seminar name? <br />
<br />
So what I want is for them to enter their email, phone number and name, but the seminar field is already filled in upon arriving at the page.<br />
<br />
Any ideas on how this can be done?<br />
It would be much appreciated!<br />
ThanX!!<!--content-->Thanks for the link, I was wondering though am I able to take those variables passed in and put them in the value="..." part of the input tag....so that the field is filled with that parameter upon entering that page. To my knowledge I cant extract those variables out in javascript and be able to use them in HTML like in the form? <br />
<br />
Thats where I'm having trouble....maybe I'm just seeing something wrong?<br />
<br />
Thanks again,<br />
Chris<!--content-->are you using straight HTML... easy to do with ASP or PHP.<br />
<br />
never actually needed to do it outside of those lanuguages<br />
<br />
usaully it is just a <% request.string("passedfield")%> in asp<br />
<br />
sorry if i am no help<br />
<br />
-sdonato<!--content-->i just usually use request("") it is easier to remeber <br />
<br />
i forgot about the QueryString part.<br />
<br />
thanks for reminding me ;)<br />
<br />
-sdonato<!--content-->Thanx Dave, thats actually how I did end up setting the field like that, but I pass what I want in the field after the url like <br />
?Begin_With_the_End_in_Mind and on this new pop up window which is a registration for, that seminar field is filled with that.<br />
<br />
I used<br />
<br />
var str = location.search.substring(1);<br />
document.register.course.value = str;<br />
<br />
in javascript to get the parameter fromthe url, however my problem is that the field still contains the underscores, not that I'm too bother by that, but I would like to remove them, and I tried to run through the string searching for eah '_' and replace it by a ' ' space, but it doesnt seem to work?<br />
<br />
Maybe the syntax is wrong,<br />
<br />
for(i=1;<=str.length;i++)<br />
{<br />
if(str=='_')<br />
str=' ';<br />
}<br />
and then I have the line with document.register.course.value =str;<br />
<br />
so I'm not sure what I'm doing wrong<br />
<br />
Advice would be appreciate if you have any ideas....<br />
<br />
Thanx again you've been a big help<!--content-->Great! Thanx dave, you've been a huge help!<!--content-->Small problem again, for some reason it onl removes the first underscore. If I call this line<br />
<br />
str = str.replace(/_+/," ");<br />
<br />
every time it will replace one more undersocre in the line and then finally write this to put it in the field<br />
<br />
document.register.course.value = str;<br />
<br />
I was wondering how this can be resolved, whether it needs a loop to go through and call the replace function multiple times or if there is another way around it.<br />
<br />
Thanx again<!--content-->Thanx again Dave, you're a big help. I ended up getting it working with a loop, but this is much more efficient. Thanx.<!--content-->
 
Back
Top