PDA

View Full Version : Having trouble with this form?


Crash1hd
11-09-2003, 03:43 AM
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
<script>
function activity(){
this.form.action='asppage.asp'
}
</script>

<form method="post">
<input type=button value="click me" onclick="activity()">
</form>
</BODY>
</HTML>

gives me an error of this.form is null

ok so doing the following seems to have fixed that yet I am now getting the same error on this code


<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT language="JavaScript">
function activity(object){
object.action='http://www.google.com'
}
</script>
</HEAD>

<BODY>

<form>
<A HREF="#" onClick="activity(this.form)">blah</A>
<A HREF="#" onClick="this.form.action='http://www.google.com';">blaa</A>
<input type='submit' value='click me' onClick="activity(this.form)">
<input type='submit' value='Go Back' onClick="this.form.action='http://www.google.com';">
</form>

</BODY>
</HTML>

the blaa and the blah give the error

xupaosso
11-09-2003, 07:41 AM
What exactly do you want to do with this code? I can think of a number of answers, but it all depends on where you want to go with the links! :)

Crash1hd
11-09-2003, 08:13 AM
I will have form fields that after you fill in and click submit it goes to a confirm page on that confirm page there will be a link at the bottem that says click here to view sample of what it will look like in not so many words! When you click that link it opens a small page with everything in the form that you entered! After the user likes what they see they close it which puts them back on the main page at the bottem has to buttons complete and go back when you click on those buttons it takes the same form info to the next page but not in a new window! Which is why i am unable to use a button for the samples cause to make it open into a new window the form field has to look as follows

<form action="webpage" method="post" target="_Blank">

The problem with that is that all the buttons would open a new page, so I have to use a link that I can specify how it opens new page or not! yet I always get an error useing a link instead of a button however I have used dropdowns which would reload the page and onload with specific info it will open the new page but I would rather not have to use a dropdown and have to refresh the page!

:D I hope that makes sense :confused: :thumbsup:

xupaosso
11-09-2003, 09:36 AM
Have you tried using javascript to change the form property of "target"? So when you onClick the one button for example:

function gotonew(){
document.form.target="_blank";
}

and the other one would lead you to:

function stayinsame(){
document.form.target="_self";
}

I'm not sure if that is any help to you. If you had some code I could try to work it out on my side...

Crash1hd
11-10-2003, 12:44 PM
Nope that wont work as I cant call them appropertly! However I found the following code works great!

this.form.target='_blank';

inside the button field as follows

<input type='submit' value='Click Here' onClick=""this.form.target='_blank';this.form.action='Purchase_Mem.asp?dbshow=4&Mtemplate="&Request.Form("Mtemplate")&"';"">

I dont know why I didnt see it sooner!:rolleyes:

Thanks anyhow!:thumbsup: