M
Miles Davenport
My Javascript is rather rusty ... and I need to do change some form
values, in the folowing way:
(1).
I have the following a href (wrapped in PHP), which calls processForm.
====
<input type="hidden" name="myHiddenValue">
href="javascript:void(0)" onClick="processForm(\'' . $form_name
.. '\', \'move\')
1
2 function processForm(formName,hidVal) {
3 document.formName.myHiddenValue.value = hidVal;
4 document.formName.submit();
5 }
====
Can someone please tell me how to incorporate the formName variable,
so I can reference the "document.****formName****.myHiddenValue.value"
correctly.
I then need call form.submit(); in a similar way.
(2)
I originally had the following code (which didn't work with later
version of apache):
====
echo (' <A class=NavBarFont href="#" onClick="document.' .
$form_name . '.myHiddenValue.value=\'delete\';document.' . $form_name
.. '.submit();">delete</a>' . "\n");
====
Can someone please tell me if there is a better way of writing this
bit of Javascript. I am open to suggestions. I cannot believe, I
cannot remember how to mix variables and ojb references, but I have
tried eval, and lots of other things.
Any help is greatly appreciated.
thanks
Miles.
values, in the folowing way:
(1).
I have the following a href (wrapped in PHP), which calls processForm.
====
<input type="hidden" name="myHiddenValue">
href="javascript:void(0)" onClick="processForm(\'' . $form_name
.. '\', \'move\')
1
2 function processForm(formName,hidVal) {
3 document.formName.myHiddenValue.value = hidVal;
4 document.formName.submit();
5 }
====
Can someone please tell me how to incorporate the formName variable,
so I can reference the "document.****formName****.myHiddenValue.value"
correctly.
I then need call form.submit(); in a similar way.
(2)
I originally had the following code (which didn't work with later
version of apache):
====
echo (' <A class=NavBarFont href="#" onClick="document.' .
$form_name . '.myHiddenValue.value=\'delete\';document.' . $form_name
.. '.submit();">delete</a>' . "\n");
====
Can someone please tell me if there is a better way of writing this
bit of Javascript. I am open to suggestions. I cannot believe, I
cannot remember how to mix variables and ojb references, but I have
tried eval, and lots of other things.
Any help is greatly appreciated.
thanks
Miles.