[thelist] form reference conundrum

Tom Dell'Aringa pixelmech at yahoo.com
Wed Jan 8 11:31:01 CST 2003


I'm trying to access an element in my form to write a value to it.
I'm using the DOM lvl 0 as I always do, yet its not working and it
seems it should..maybe someone can point out my error.

Here is the form:
--------------------
<form name="cartadd" method="POST" action="/preCart.php"
style="display: inline; height: auto;" onsubmit="track(this)">

<input type="hidden" name="cust" value="">
//more elements
</form>
--------------------

I want to access 'cust', the hidden element. I am doing this:

-------------------
oForm = document.forms["cartadd"];
custHidden = oForm.elements["cust"]; <-- errors as null or not object
-------------------

oForm returns an object for sure in an alert. 'cust' is indeed the
name of the element. There are no other forms on this page named
cartadd, nor any other form elements named cust... I can't figure
this out!

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list