473,241 Members | 1,769 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,241 software developers and data experts.

Issue with setting hidden value from url

Hi All,

I'm not too proficient in Javascript but am trying to help a friend
out. Bascially, the page we are having trouble with is loaded with a
numerical value in the url string. Example:

http://www.webpage.com/v4/payment_pg...cimal%20=49.50

I then parse the string to get the total. I then want to assign the
value to a hidden form value
(document.form1.FeeCalcTotalDecimal.value) The hidden value is to be
used to post to a bank's website.

I'm sure this is just a syntax issue, but I'm stumped. Keep getting
"document.form1.FeeCalcTotalDecimal.value is null or not an object."

<CODE>

<script language="JavaScript">

function parseGetVars() {
var getVars = new Array();
var qString = unescape(top.location.search.substring(1));
var pairs = qString.split(/\&/);
for (var i in pairs) {
var nameVal = pairs[i].split(/\=/);
getVars[nameVal[0]] = nameVal[1];
}
return getVars;
}
</script>

<script>
var g = parseGetVars();
for (var i in g)
document.writeln('Your total fee is $' +g[i]+'<br>');
document.form1.FeeCalcTotalDecimal.value = '+g[i]+' ; THIS ISN'T
WORKING!!
</script>
<br />
</font</div>
<table width="715" height="52" border="0">
<tr>
<td align="center" width="374" height="48"<form
name="form1" method="post" action="https://secure.linkpt.net/lpcentral/
servlet/lppay">
<input type="hidden" name="txntype" value="sale">
<input type="hidden" name="storename" value="1001184858">
<INPUT type="hidden" name="chargetotal"
value="FeeCalcTotalDecimal">
<input type="hidden" name="suppressTitle" value="true">
<input name="Submit" type="submit" id="Submit" value="Submit">
</td>
<td width="331">
</div>
</form></td>
</tr>
</table>

</CODE>

Thanks in advance for your help!

JCC
Jun 27 '08 #1
3 1209
JCCDevel wrote:
I'm not too proficient in Javascript but am trying to help a friend
out.
FOAF? Yeah, sure ;-)
[...]
I then parse the string to get the total. I then want to assign the
value to a hidden form value
(document.form1.FeeCalcTotalDecimal.value) The hidden value is to be
used to post to a bank's website.

I'm sure this is just a syntax issue, but I'm stumped. Keep getting
"document.form1.FeeCalcTotalDecimal.value is null or not an object."
The script is located before the control in the markup; the control does
not exist at that point. Besides, your markup is not Valid[1] and you are
using proprietary syntax. Use instead, after the control was parsed:

document.forms["form1"].elements["FeeCalcTotalDecimal"].value

[1] http://validator.w3.org/
HTH

PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jun 27 '08 #2
JCCDevel wrote on 17 apr 2008 in comp.lang.javascript:
document.form1.FeeCalcTotalDecimal.value = '+g[i]+' ; THIS ISN'T
WORKING!!
reason1:

The form form1 is not yet declared and so not yet part of the DOM.

reason2:

<INPUT type="hidden" name="chargetotal"
value="FeeCalcTotalDecimal">

Should be something like:

<INPUT type="hidden" name="FeeCalcTotalDecimal"
value="">
=============================

Why use outmoded
<script language="JavaScript">
and
<script>
where
<script type='text/javascript'>
is the standard?

Why split the script in two?

Change 1
document.form1.
to
document.forms.form1.

<table width="715" height="52" border="0">
use css styles instead!

In the end,
better fill the hidden input with serverside code.
ASP example:

<INPUT type="hidden" name="FeeCalcTotalDecimal"
value = '<% = serversideValue %>'>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '08 #3
On Apr 17, 12:05*pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
JCCDevel wrote:
I'm not too proficient in Javascript but am trying to help a friend
out.

FOAF? *Yeah, sure ;-)
[...]
I then parse the string to get the total. I then want to assign the
value to a hidden form value
(document.form1.FeeCalcTotalDecimal.value) The hidden value is to be
used to post to a bank's website.
I'm sure this is just a syntax issue, but I'm stumped. *Keep getting
"document.form1.FeeCalcTotalDecimal.value is null or not an object."

The script is located before the control in the markup; the control does
not exist at that point. *Besides, your markup is not Valid[1] and you are
using proprietary syntax. *Use instead, after the control was parsed:

* document.forms["form1"].elements["FeeCalcTotalDecimal"].value

[1]http://validator.w3.org/

HTH

PointedEars
--
* * realism: * *HTML 4.01 Strict
* * evangelism: XHTML 1.0 Strict
* * madness: * *XHTML 1.1 as application/xhtml+xml
* * * * * * * * * * * * * * * * * * * * * * * * * * -- Bjoern Hoehrmann
Thank you both for your suggestions. I have asked my friend(and yes
Thomas, it is for a friend - she is strictly a designer and hasn't had
to do this type of thing before) to plug this into her page. I'm used
to using server side code and her page is just stand-alone. I truly
appreciate your help!
Jun 27 '08 #4

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

Similar topics

1
by: Jim | last post by:
I have a 2 checkboxes and a hidden field..what I want to happen is that you can only click on 1 of these checkboxes at a time and when you check a checkbox it will assign the hidden field...
1
by: Rob Meade | last post by:
Hi all, I have a loop in my code which builds the controls on the page. I at one stage need to add some hidden input controls dynamically, I have achieved this, and I have set their...
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
4
by: PJ6 | last post by:
From a control's onkeypress the below javascript snippet is executed. I am attmpting to set the value of a hidden field... I believe I'd be able to get the contents of the hidden field by using...
1
by: Harshal P | last post by:
Hello, I am settings hidden field value from the DayRender event hadler of the asp.net calendar control, when i try to read the value of hidden field from javascript, the value is empty string. If...
3
by: rob c | last post by:
Hi I'm not sure if this is the right place to ask for help on forms and radio buttons... In the following form, I'd like to set the value of 'item_name' based on which radio button was...
0
by: bruce | last post by:
hi... it appears that i'm running into a possible problem with mechanize/browser/python rgarding the "select_form" method. i've tried the following and get the error listed: br.select_form(nr...
2
by: corykendall | last post by:
Here is my code: ... Setting hidden input to: <dsp:valueof param="tabname"/> <input name="tabname" type="hidden" value='<dsp:valueof param="tabname"/>'/> </dsp:form> hidden input set...
1
by: worldofrugs | last post by:
I'm hosted on a shared server with Godaddy.com... I have several forms on my website that all use the same ASP file to send out my forms.. It worked fine for a long time, but now the forms send to...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.