aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to pass a dynamic generate form name to javascript function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to pass a dynamic generate form name to javascript function" Watch "How to pass a dynamic generate form name to javascript function" New topic
Author

How to pass a dynamic generate form name to javascript function

lijun wang
Greenhorn

Joined: Jan 20, 2006
Posts: 28
here is javascript
------------------------------------------------
calcTotals(price,form){
alert(form);
var arrElem = document.form.elements;
}
-------------------------------------------------
#{pc_DetailView.namespace}calcTotals(this,'view#{pc_DetailView.namespace}:form1')

alert(form) output: viewPC_7_0_OKD_:form1

but has error on "arrElem = document.form.elements"
"document.form has no properities"
I think "document.form.elements" should be: "document.viewPC_7_0_OKD_:form1.elements" instead of "document.form.elements"

please help me!!
Nimchi Yung
Ranch Hand

Joined: Jan 27, 2004
Posts: 71
Why don't you just use the form that you passed to your javascript function?

--Nimchi
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
document.forms[formName]

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass a dynamic generate form name to javascript function
 
Similar Threads
HTML elements name
Page Bean not setting text property
Help
passing formname and texboxname in a function as parameter
Can't get Text value from ENCTYPE=multipart/form-data