Re: Change the Form action
From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 01/31/05
- Next message: Lirco: "Re: Can i use CDO to send a message with Priority High?"
- Previous message: Nic Roche: "Re: Change the Form action"
- In reply to: MichaelK: "Re: Change the Form action"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 31 Jan 2005 10:06:54 -0500
MichaelK wrote:
> Just a few comments to your example.
> It works indeed, but only when you have id attribute in the form or
> input tags.
> Unfortunately I just wanted to make a few quick fixes to existing
> pages, which don't have them
> (ofcourse I could add).
If you only have one form on a page, you can reference the form by its
ordinal index rather than its id/name:
document.forms(0).action
> But again it also works only when you have <script
> language="VBScript">,
That is what you seemed to be asking for ...
> and not working on asp pages when using just <%
> %> blocks of the code.
If you wanted a server-side solution, you should have said so. It would have
been very easy to respond:
Changing the Form action after submission is not possible using server-side
code.
> But here was my fault
Definitely
> I wasn't clear about
> what I was looking for. I just hate
> to use <script language="VBScript">, because it's available on the
> page source
> for anybody.
You cannot respond to client-side events without using client-side code.
Period.
You cannot change DHTML properties (such as the form's action property)
without using client-side code. Period.
> And the last even I add the id attribute and use <vbscript...> it
> doesn't work in
> Netscape at all.
Netscape does not support client-side vbscript. Netscape only supports
javascript in client-side code. Why did you ask for a client-side vbscript
solution if you expected users to be using Netscape? Oh that's right, you
didn't think that's what you were asking for.
You have fallen into the trap of thinking that vbscript is server-side and
javascript is client-side. Change your thinking. With ASP, both jscript and
vbscript can be used in server-side code. With IE, both vbscript and jscript
can be used in client-side code. In Netscape with no plugin, only javascript
can be used in client-side code.
The distinction is "server-side vs. client-side," not "vbscript vs
javascript". You will get more appropriate help if you use the proper
terminology.
Since you want to validate using server-side code, you will need to put the
validation code where it will run after the form is submitted. Without
client-side code it will be impossible to change a form's action property on
submission. You can use Server.Transfer or Response.Redirect in server-side
code based on the content of the submission.
A better newsgroup for server-side asp questions is
microsoft.public.inetserver.asp.general.
Bob Barrows
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
- Next message: Lirco: "Re: Can i use CDO to send a message with Priority High?"
- Previous message: Nic Roche: "Re: Change the Form action"
- In reply to: MichaelK: "Re: Change the Form action"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|