PDA

Click to See Complete Forum and Search --> : Simple ? Sumbit and ASP


dndstef
Oct 12th, 2000, 02:51 PM
With this code i submit my name and nickname to
an ASP page.


<Form Method="post" Name="Form1" Action="Second.asp">
<Input Type="Text" Size="26" Name="Name">
<Input Type="Text" Size="26" Name="Nickname">
<Input Type="submit" Value="Submit" Name="Go">
</Form>


But i want to replace the submit button by a image, how
do i do that. And i want it to work on both Netscape and
Explorer.

Thanks!

monte96
Oct 12th, 2000, 07:48 PM
<%@ Language=VBScript %>
<%
If Request.Form("Name").Count > 0 Then
Response.Write Request.Form("Name") & " - " & Request.Form("Nickname") & "<BR>"
End If
%>
<HTML>
<HEAD>
<SCRIPT language=javascript>
function submitme(){
Form1.submit();
}
</SCRIPT>
</HEAD>
<BODY>
<Form Method="post" id=Form1 Action="_Test2.asp">
<Input Type="Text" Size="26" Name="Name">
<Input Type="Text" Size="26" Name="Nickname">
<img SRC="Images/ie4get_animated.gif" WIDTH="88" HEIGHT="31" BORDER="0" usemap=#submitmap>
</Form>
<MAP name=submitmap>
<AREA shape="rect" coords="0,0,88,31" onclick="submitme()">
</MAP>
</BODY>
</HTML>

Mark Sreeves
Oct 13th, 2000, 02:44 AM
This works with Netscape and IE

(change file names to suit your needs)

<head>
</head>

<body bgcolor="50D0FF">

<Form Method="post" Name="Form1" Action="/scratch/some.asp">
<Input Type="Text" Size="26" Name="Name">
<Input Type="Text" Size="26" Name="Nickname">
</Form>


<A href="javascript:document.Form1.submit()"><img src="./wallpaper/100.jpg"></A>


</body>

</html>

dndstef
Oct 17th, 2000, 10:50 AM
Thanks i'm gonna try both.

By the way i'va another question on a similar topic.

Can it be done using a flash Button without having
to pass every variable direclty into flash coz it's
a bit tricky when you have many different variable.

So now it's not basics anymore.
But maybe someone knows how to do it.

dndstef
Oct 18th, 2000, 12:40 PM
I have try to replace a submit button with an image an a
javascript, but i need to pass a variable too just like
a button.

So i have have a form with two button [Add] & [Modify]


<Form Method="post" Name="Form1" Action="Second.asp">

<select name="menu1">
<option selected>1</option>
<option>2</option>
<option>3</option>
</select>
<input type=submit name=Action value=Add>
<input type=submit name=Action value=Modif>
</Form>


In Second.asp
I'm trapping wich button have been click with the variable
Request.Form("Action").

But when i use this

<A href="javascript:document.Form1.submit()">Image Add<A>
<A href="javascript:document.Form1.submit()">Image2 Modify<A>

Instead of a button i can't submit the variable. Is there
a way to add that. Or is it impossible, it still have to
be compatible IE and Netscape.

Thanks anyway! You've helpe me a lot already.

Mark Sreeves
Oct 19th, 2000, 02:35 AM
Try this:
I've put the 2 buttons on a separate form so they don't appear in the request string.

Buttons have to be on a form for them to work in netscape
(IE doesn't care)


Also, I would avoid using methods and properties etc for names of controls.

you had buttons called "Action"

This is asking for trouble because Form1.Action is "second.asp" !



<HTML>
<HEAD>

<script language=javascript>
function doIt(opt)
{
document.Form1.Act.value=opt;
document.Form1.submit();

}

</script>

</HEAD>
<BODY>

<Form Method="post" Name="Form1" Action="Second.asp">
<select name="menu1">
<option selected>1</option>
<option>2</option>
<option>3</option>
</select>
<input type=hidden name=Act>
</Form>
<form name=frm2>
<input type=button value="Add" onClick="doIt(this.value)">
<input type=button value="Modify" onClick="doIt(this.value)">
</Form>

</BODY>
</HTML>

dndstef
Oct 19th, 2000, 08:05 AM
I've found a way to do it with many images button
with javascript. And it works fine.

To those who want to know how, e-mail me at dndlinux@hotmail.com