M
mikew01
Hi all I am trying to write a function that changes a forms action on
the fly, submits the form then changes the action back again.
The reason I need to do this is because the forms primary action when
the submit button is pressed is to pass control back to the client
page that created the new page but I have added a drop down widget to
the page that when changed needs to re-submit the current page.
Heres the function, it works to a certain degree in that it changes
the action the first time and the current page is submitted but the
final statement to set the action back to the original uri does not
seem to work, the action stays set to the first assignment so when the
submit button is pressed the page just submits itself again?
function submitform( loadaction, formname, originalaction )
{
document.getElementsByName( formname )[0].action = loadaction;
document.getElementsByName( formname )[0].submit();
document.getElementsByName( formname )[0].action = originalaction;
}
Any idas why the final statement doesn't seem to work?
TIA
Mike.
the fly, submits the form then changes the action back again.
The reason I need to do this is because the forms primary action when
the submit button is pressed is to pass control back to the client
page that created the new page but I have added a drop down widget to
the page that when changed needs to re-submit the current page.
Heres the function, it works to a certain degree in that it changes
the action the first time and the current page is submitted but the
final statement to set the action back to the original uri does not
seem to work, the action stays set to the first assignment so when the
submit button is pressed the page just submits itself again?
function submitform( loadaction, formname, originalaction )
{
document.getElementsByName( formname )[0].action = loadaction;
document.getElementsByName( formname )[0].submit();
document.getElementsByName( formname )[0].action = originalaction;
}
Any idas why the final statement doesn't seem to work?
TIA
Mike.