Has anyone meet this before
I have this Javascript function that is supposed to change a value before submitting the form.
The form name is dynamic, so is the value
The code works fine in IE, but not in either of the other two browsers.
Does anyone have any idea how to get around this one?
I can't use getElementById, because that just gets the first Task, and I have multiple forms, all with the Element "Task".
I have this Javascript function that is supposed to change a value before submitting the form.
The form name is dynamic, so is the value
Code:
function SubmitForm(What,DoWhat) {
var f=document.getElementById(What);
[COLOR=red]f.Task.value = DoWhat;[/color] // <<<<<< FireFox fails on this
f.submit();
}
later...
<form name="modForm1" action="etc">
<input type="button" onclick="Javascript:SubmitForm('modForm1','Modify');" value="Modify This Entry"/>
<input type="button" onclick="Javascript:SubmitForm('modForm1','Delete');" value="Delete This Entry"/>
</form>
<form name="modForm2" action="etc">
<input type="hidden" name="Task" value="" />
<input type="button" onclick="Javascript:SubmitForm('modForm2','Modify');" value="Modify This Entry"/>
<input type="button" onclick="Javascript:SubmitForm('modForm2','Delete');" value="Delete This Entry"/>
</form>
The code works fine in IE, but not in either of the other two browsers.
Does anyone have any idea how to get around this one?
I can't use getElementById, because that just gets the first Task, and I have multiple forms, all with the Element "Task".