I've been fighting with this for an hour.
My form contains a hidden input with the value initially set to "".
When a user clicks on the link, a function is called that updates the hidden
form value and submits the form.
Unfortunately this generates an error which states the form object is
undefined.
The function looks like
<script type='text/javascript'>
function submitLink(theForm, theName, theValue) {
document.theForm.theName.value = theValue;
document.theForm.submit();
}
</script>
The form looks like
<form action="product/details" method="post" name="catxml" />
<input type="hidden" name="familyid" value="" />
<a href="javascript: submitLink(document.catxml, familyid, '456');">Product
1</a>
</form>
The error reports that 'familyid is undefined'.
Can someone clue me in? Thanks. 4 45800
On Jan 30, 2:35 pm, "Bosconian" <nob...@nowhere.com>
wrote:
My form contains a hidden input with the value initially
set to "". When a user clicks on the link, a function is
called that updates the hidden form value and submits the
form.
<script type='text/javascript'>
function submitLink(theForm, theName, theValue) {
document.theForm.theName.value = theValue;
theForm [ theName ] . value = theValue ;
document.theForm.submit();
theForm . submit ( ) ;
}
</script>
<form action="product/details" method="post"
name="catxml" />
Utter nonsense. The trailing slash in XML denotes a
childless element. That is, the following two notations are
semantically identical:
<form/>
and
<form></form>
Later on there's a closing tag for the form element in your
document. As it is, it doesn't make any sense--the document
is neither XML nor HTML. I'd strongly advise sticking to
HTML 4.01 Strict, at least until you start getting some
understanding of the matter.
<input type="hidden" name="familyid" value="" />
<a href="javascript: submitLink(document.catxml,
familyid, '456');">Product 1</a>
<a
onclick=
"
submitLink
(
document . forms [ 0 ] , 'familyid', '456'
) ;
">
Product 1
</a>
</form>
The error reports that 'familyid is undefined'.
Naturally. Is familyid defined, after all? Not in the code
snippet you showed us, anyway.
Can someone clue me in? Thanks.
Without meaning to be rude, you managed to demonstrate
appaling ignorance in just a few lines of code. Either read
some good literature on the matter (and I don't mean just
JavaScript, your understanding is obviously just as lacking
where HTML and XML are concerned), find yourself a capable
mentor willing to teach you, or give it up.
--
Pavel Lepin
<p.*****@ctncorp.comwrote in message
news:11*********************@q2g2000cwa.googlegrou ps.com...
>
On Jan 30, 2:35 pm, "Bosconian" <nob...@nowhere.com>
wrote:
>My form contains a hidden input with the value initially set to "". When a user clicks on the link, a function is called that updates the hidden form value and submits the form.
<script type='text/javascript'> function submitLink(theForm, theName, theValue) { document.theForm.theName.value = theValue;
theForm [ theName ] . value = theValue ;
> document.theForm.submit();
theForm . submit ( ) ;
> } </script>
<form action="product/details" method="post" name="catxml" />
Utter nonsense. The trailing slash in XML denotes a
childless element. That is, the following two notations are
semantically identical:
<form/>
and
<form></form>
Later on there's a closing tag for the form element in your
document. As it is, it doesn't make any sense--the document
is neither XML nor HTML. I'd strongly advise sticking to
HTML 4.01 Strict, at least until you start getting some
understanding of the matter.
><input type="hidden" name="familyid" value="" /> <a href="javascript: submitLink(document.catxml, familyid, '456');">Product 1</a>
<a
onclick=
"
submitLink
(
document . forms [ 0 ] , 'familyid', '456'
) ;
">
Product 1
</a>
></form>
The error reports that 'familyid is undefined'.
Naturally. Is familyid defined, after all? Not in the code
snippet you showed us, anyway.
>Can someone clue me in? Thanks.
Without meaning to be rude, you managed to demonstrate
appaling ignorance in just a few lines of code. Either read
some good literature on the matter (and I don't mean just
JavaScript, your understanding is obviously just as lacking
where HTML and XML are concerned), find yourself a capable
mentor willing to teach you, or give it up.
--
Pavel Lepin
You are right about one thing. I'm a backend developer. We usually leave the
front-end stuff to "webmasters" and HTML jockeys like yourself.
I have to wonder though, why would anyone even bother spending the time to
craft a response like yours?
I suppose one can hardly blame you. You have to go through life with the
name "Pavel Lepin", the guy who got pounded daily in high school and who's
never kissed a girl. I suspect being a webmaster is really the only thing
you're good at. Just keep tell yourself, "chicks dig HTML."
Have a nice day.
<p.*****@ctncorp.comwrote in message
news:11*********************@q2g2000cwa.googlegrou ps.com...
>
On Jan 30, 2:35 pm, "Bosconian" <nob...@nowhere.com>
wrote:
>My form contains a hidden input with the value initially set to "". When a user clicks on the link, a function is called that updates the hidden form value and submits the form.
<script type='text/javascript'> function submitLink(theForm, theName, theValue) { document.theForm.theName.value = theValue;
theForm [ theName ] . value = theValue ;
> document.theForm.submit();
theForm . submit ( ) ;
> } </script>
<form action="product/details" method="post" name="catxml" />
Utter nonsense. The trailing slash in XML denotes a
childless element. That is, the following two notations are
semantically identical:
<form/>
and
<form></form>
Later on there's a closing tag for the form element in your
document. As it is, it doesn't make any sense--the document
is neither XML nor HTML. I'd strongly advise sticking to
HTML 4.01 Strict, at least until you start getting some
understanding of the matter.
><input type="hidden" name="familyid" value="" /> <a href="javascript: submitLink(document.catxml, familyid, '456');">Product 1</a>
<a
onclick=
"
submitLink
(
document . forms [ 0 ] , 'familyid', '456'
) ;
">
Product 1
</a>
></form>
The error reports that 'familyid is undefined'.
Naturally. Is familyid defined, after all? Not in the code
snippet you showed us, anyway.
>Can someone clue me in? Thanks.
Without meaning to be rude, you managed to demonstrate
appaling ignorance in just a few lines of code. Either read
some good literature on the matter (and I don't mean just
JavaScript, your understanding is obviously just as lacking
where HTML and XML are concerned), find yourself a capable
mentor willing to teach you, or give it up.
--
Pavel Lepin
Hi Pavel,
I wanted to let you know that you inspired me "not to suck." As a result of
you being a complete jerk and arrogant asshole, I pushed on ahead and
discover the error in my ways.
Best of luck belittling future posters and here's hoping you get laid
someday.
"Bosconian" <no****@nowhere.comwrote in message
news:lc******************************@comcast.com. ..
I've been fighting with this for an hour.
My form contains a hidden input with the value initially set to "".
When a user clicks on the link, a function is called that updates the
hidden form value and submits the form.
Unfortunately this generates an error which states the form object is
undefined.
The function looks like
<script type='text/javascript'>
function submitLink(theForm, theName, theValue) {
document.theForm.theName.value = theValue;
document.theForm.submit();
}
</script>
The form looks like
<form action="product/details" method="post" name="catxml" />
<input type="hidden" name="familyid" value="" />
<a href="javascript: submitLink(document.catxml, familyid,
'456');">Product 1</a>
</form>
The error reports that 'familyid is undefined'.
Can someone clue me in? Thanks.
For those of you playing along at home, here's how the code ended up:
<script type='text/javascript'>
function submitLink(theForm, theName, theValue) {
theForm.elements[theName].value = theValue;
theForm.submit();
}
</script>
<form action="product/details" method="post" name="catxml">
<input type="hidden" name="familyid" value="" />
<a href="javascript : submitLink(document.catxml, 'familyid',
'455');">Product 1</a>
</form>
I made two corrections:
1) The first parameter in the function call already included the document
object and the duplicate was removed from within the function.
2) The second parameter is a variable string reference of the form element
and needed to be handled as such.
As it turns out, familyid was indeed defined and clearly evident in the
form--it just wasn't being referenced properly.
Lessons learned:
1) Coding while sleep-deprived only leads to sloppy mistakes and oversights.
2) Ignore arrogant assholes who have nothing to contribute to the community
except unconstructive criticism and negativity.
While on the subject, Pavel evidently thought the code was XML because the
opening form tag had a trailing slash (which, while incorrect, is
subsequently ignored by the brower) and the form is named "CatXML".
Poor pathetic Pavel. :-( This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt Herson |
last post by:
I have been trying to find a way to use JavaScript to change the value of a
hidden field on submit. I am already invoking a JavaScript to handle the
validation on submit.
The reason I need to...
|
by: Wim Roffal |
last post by:
Is it possible to use javascript to change the name of a field in a form?
Thanks,
Wim
|
by: juglesh |
last post by:
hi, all, thanks for reading.
i have a form in which i want drop down boxes to dynamically change some
hidden fields:
http://cynthialoganjewelry.com/test4.htm
<form name=test method="post" >
...
|
by: Cady |
last post by:
I'm trying to do an automatic signup for a newsletter hosted on a
separate site.
The original page is to sign up to receive a catalog by mail, with an
option to signup for an e-newsletter. All...
|
by: John Oliver |
last post by:
I'd like the email produced by FormMail to show a specific From: address
rather than postmaster@server.host.name Googling isn't helping me...
not sure what to look for :-(
--
* John Oliver ...
|
by: norman29 |
last post by:
Hi all!
How can i do this:
<form method="get" action="test.asp" >
<input name="boys" type=radio value="John">John
<input name="boys" type=radio value="Lu">Lu
<input name="boys"...
|
by: cassbiz |
last post by:
I may be in the wrong forum so Ronald don't shoot :)
In my code I have an option box to choose a number - works fine. I want to carry over the new value to another field to do a recalculation.
...
|
by: pozitronic |
last post by:
Hey all,
I would like to do the following:
I have 3 radio boxes.
<input name="br" type="radio" value="first">Button1<br>
<input name="br" type="radio" value="second">Button2<br>
<input...
|
by: thatcollegeguy |
last post by:
Below are my 3php and 2js files.
I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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: 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: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |