Results 1 to 7 of 7

Thread: Simple ? Sumbit and ASP

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    67

    Question

    With this code i submit my name and nickname to
    an ASP page.

    Code:
    <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!
    If possible please provide codes.
    Process by example is the best way to learn.

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Code:
    <%@ 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>
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    This works with Netscape and IE

    (change file names to suit your needs)
    Code:
    <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>
    Mark
    -------------------

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    67

    Post Can we work with flash to

    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.
    If possible please provide codes.
    Process by example is the best way to learn.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    67

    Post Javascript submit() ?

    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]

    Code:
    <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
    Code:
    <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.
    If possible please provide codes.
    Process by example is the best way to learn.

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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" !


    Code:
    <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>
    Mark
    -------------------

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    67

    Post Thanks for everyone

    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
    If possible please provide codes.
    Process by example is the best way to learn.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width