[Javascript] Form action

Andrew Gibson andyg at ihug.co.nz
Tue Nov 11 15:28:55 CST 2003


I  can't see any great problem in doing this, and if its the only way....?

Could you put the querystring in the form tag - though obviously I don't
know your overall logic

<form action='/main.asp?<%=request.querystring()%>'  >

or even in a onSubmit function

function submitMe()
{
document.CrystalViewerCrystalForm.action='/main.asp?<%=request.querystring()
%>'
}

Andrew



=====================================================
Is it findamentally bad behavior to change a form's "action" property?

Ex:  Crystal RAS creates a form that posts to itself, assuming that the
page will make another request for the form to be processed/repainted.
For whatever reason, the querystring parameters are not included in the
action URL.  So in order to maintain the correct page context, I've
appended some 'fixer' code after the call to the report object:

Response.write("<script type='text/javascript'>")
Response.write("document.CrystalViewerCrystalForm.action='/main.asp?" &
Request.QueryString & "'" )
Response.write("</script>")

Now the page works the way it is supposed to, and I don't think I'm
incurring too much performance penalty by rewriting the action property
on the fly - but I was wondering what other javascript developers
thought about this tactic....






More information about the Javascript mailing list