Hi there,
I have a formular, where I named some of the textfields:
field[0], field[1], etc...
others I named word[0], word[1], etc...
Now I want to reset only some fields with a button. F.e. all 'fields' or all 'words'.
A document.formname.field.value=""; or something like that doesn't work, because I seemingly can't use fieldnames, which include brackets.
Any idea?
Thanks Alex
adressing formfields named with php array variables
Moderators: egami, macek, gesf
-
- php-forum Active User
- Posts: 264
- Joined: Tue Apr 08, 2003 5:18 am
- Location: Ottawa, Canada
- Contact:
since you will be using JS, you could use eval()
and name your fields field0, field1....
then try something like this, tho i am not making any guarantees:
for(counter=0;counter<someVal;counter++){
eval("document.formname.field"+counter+".value=''")
}
:wink:
and name your fields field0, field1....
then try something like this, tho i am not making any guarantees:
for(counter=0;counter<someVal;counter++){
eval("document.formname.field"+counter+".value=''")
}
:wink: