File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Dynamic Form Element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dynamic Form Element" Watch "Dynamic Form Element" New topic

Dynamic Form Element

Nandhini Sridharan
Ranch Hand

Joined: Oct 26, 2006
Posts: 58

I have a form element say textfield and name of that text field is say quality_03. the 03 is calculated dynamically. Finally I would like to assign a value for that text field say.,


var numVal=03 // Its calculated in loop I have given this for an example.

For this I have used

var txt = form."quality"+"_"+numVal.value
var txt=3

But it didnt accept. It shows the error as txt not object. Can someone help me out with this one. I need this very urgently. I have deployment tonight.

[ November 29, 2006: Message edited by: Bear Bibeault ]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
document.forms[0].elements["foo" + bar].value

I agree. Here's the link:
subject: Dynamic Form Element
It's not a secret anymore!