473,378 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Inserting variable into hidden input

Hi all,

I'm trying to insert a javascript variable into a hidden input form
field. Here's what it looks like:

<form name="loginForm"
action="scripts/wgate/ziac_login/!?~language=EN">
<input type="hidden" name="pss" value="`G_NEW_PASSWORD.value`">
<input type="hidden" name="usr" value="">
<input type="submit" value="Please Click Here to Continue">
</form>

and then later down the page I try to reassign "usr" like this:

<script>
var allcookies = document.cookie;
var position = allcookies.indexOf("user=");
var start = position + 5;
var end = allcookies.indexOf(";", start);
if (end == -1) end = allcookies.length;
var valueofuser = allcookies.substring(start, end);
valueofuser = unescape (valueofuser);
document.write(valueofuser);
document.loginForm.usr.value = valueofuser;
</script>

I can see it is printing out document.write(valueofuser) correctly, so
I know it is grabbing the user name. But it doesn't seem to want to
insert it into the form on the next line. Any suggestions?

Mar 6 '06 #1
2 1827

Navillus wrote:
Hi all,

I'm trying to insert a javascript variable into a hidden input form
field. Here's what it looks like:

<form name="loginForm"
action="scripts/wgate/ziac_login/!?~language=EN">
<input type="hidden" name="pss" value="`G_NEW_PASSWORD.value`">
<input type="hidden" name="usr" value="">
<input type="submit" value="Please Click Here to Continue">
</form>

and then later down the page I try to reassign "usr" like this:

<script>
var allcookies = document.cookie;
var position = allcookies.indexOf("user=");
var start = position + 5;
var end = allcookies.indexOf(";", start);
if (end == -1) end = allcookies.length;
var valueofuser = allcookies.substring(start, end);
valueofuser = unescape (valueofuser);
document.write(valueofuser);
document.loginForm.usr.value = valueofuser;
</script>

I can see it is printing out document.write(valueofuser) correctly, so
I know it is grabbing the user name. But it doesn't seem to want to
insert it into the form on the next line. Any suggestions?


anyone?

Mar 7 '06 #2
Navillus wrote:
Navillus wrote:
document.loginForm.usr.value = valueofuser;
</script>

I can see it is printing out document.write(valueofuser) correctly, so
I know it is grabbing the user name. But it doesn't seem to want to
insert it into the form on the next line. Any suggestions?


anyone?


I don't know what to say, this sentence is quite simple, there's nothing
to find on it =]
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
12
by: Dave | last post by:
Hello, I'm a somewhat PHP newbie, so please bear with me. Here is what I am trying to do: $foobar = "blah blah"; $a = "foo"; $b = "bar"; $fooboo = "$a" . "$b"; echo $fooboo
6
by: BigDadyWeaver | last post by:
I am using the following code in asp to define a unique and unpredictable record ID in Access. <% 'GENERATE UNIQUE ID Function genguid() Dim Guid guid =...
3
by: Geoff Winsor | last post by:
Hi, I am experiencing a problem with recalling a session variable which stores whether a person is logged in to a "members only" section of a website. This area of the site has been working...
0
by: Chumley the Walrus | last post by:
In an data insert script, I'm trying to insert a field (userid) with a textbox object, but I want it to be invisible to the user so the user cannot change it inside the textbox: <td...
6
by: 35th Ave Media | last post by:
Hello, I have about 60+ pages that I need to insert a MAILTO: tag so people can email the page using their email client. The body of the message is going to be the URL of that page. Using ASP,...
19
by: k.karthikit | last post by:
Hello all, In some hidden variable (<input type="hidden" name="hiddenId" value="test" /> ,i stored some value.I accessed the value "test" using var id = document.getElementById( 'hiddenId' );...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
4
by: jej1216 | last post by:
I'm pretty new to PHP and MySQL. I have managed to create a form that inserts data to MySQL and to create a form to search the DB. Now here is my problem. I am unsuccessful coding a hidden...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.