-
1. Re: Passing reference to current form to javascript
user1234 Dec 15, 2009 5:54 AM (in response to schenger)In the javascript you can directly access the "form" object many way, like
var frm = document.forms[index];
here by using index you can get the required form if there are multiple form inside same document.
you can directly get form object of element like this,
var form = element.form;
if you pass the object 'this' check what you are getting the in javascript by giving alert like alert(object.id)
-
2. Re: Passing reference to current form to javascript
ilya_shaikovsky Dec 15, 2009 6:02 AM (in response to user1234)1 of 1 people found this helpful -
3. Re: Passing reference to current form to javascript
schenger Dec 15, 2009 6:22 AM (in response to user1234)Hi Deb Dutta,
thank you for reply.
In the javascript you can directly access the "form" object many way, like
var frm = document.forms[index];
here by using index you can get the required form if there are multiple form inside same document.
In my case this is a portal page so there are many forms and the index of the form can be different. Also i cannot give id to the forms so i could not use
document.getElementById('formid'). They are generated elsewhere.
if you pass the object 'this' check what you are getting the in javascript by giving alert like alert(object.id)
I've tried that. I can see 'undefined' in the alert message.
maybe other ideas?
thanks a lot.
-
4. Re: Passing reference to current form to javascript
user1234 Dec 17, 2009 8:28 AM (in response to schenger)hmm...understood,
for the element get the parent form id where it is included and can pass it like this
onsubmit="disableElements('formid);
then in the js method get the form object,var formobj = document.getElementById(formid);