www.webdeveloper.com
Results 1 to 3 of 3

Thread: HTML form with multiple "actions"

Hybrid View

  1. #1
    Join Date
    Mar 2014
    Posts
    3

    HTML form with multiple "actions"

    Hey guys!

    i need your help

    how can I integrate : <FORM METHOD="LINK" ACTION="page2.html"> in the code below

    2 actions are possible?



    <form id="form1" action="javascript://" onsubmit="return authPass(this.user.value,this.pass.value)">

  2. #2
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    862
    Firstly, it turns out 'METHOD="LINK"' is invalid. Apparently using this fails and forces the form to fallback to its default, which is 'METHOD="GET"', and in this case it makes it appear to work (but again is still invalid and should be changed).

    What you seem to want isn't impossible nor is it complicated. But I do feel like more information would help me give you a proper solution.

    As far as I know you don't need 'action="javascript://"', at least in the event you are trying to run some javascript when the form submits. And then based on the first form code I assume after the javascript function is complete, if it returns true you want to redirect to page2.html? You should be able to use something like:
    HTML Code:
    <form method="get" action="page2.html" onsubmit="return authPass(this.user.value, this.pass.value)">
    And the only other thing you need to make sure you do is have the authPass() function return true or return false based on whether or not you want to go to page2.html.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  3. #3
    Join Date
    Mar 2014
    Posts
    3
    I have 2 pages HTML , with javascript login (without database) .
    Works with text file where username and password = txt file name ( leo123.txt)

    I need get the username (when someone enter username) and pass data to next page.


    Example : username : leo (Login.html) >>>>>>> (Main.html) Label Username = Leo
    If username in Main.html page <> leo close this page

    This is my code LOGIN.HTML



    <script>
    function click() {
    if (event.button==2||event.button==3) {
    oncontextmenu='return false';
    }
    }
    document.onmousedown=click
    document.oncontextmenu = new Function("return false;")
    </script>


    <script type="text/javascript">
    <!--
    function authPass(u,p) {
    if (u && p) self.location = "Auth.html?" + u + p;
    return false;
    }
    // -->
    </script>

    <div>
    <script type="text/javascript">
    <!--

    if (location.search.indexOf("auth=failed") != -1) {

    document.write("<span style=\"color:#cad439\">Error! Check your username or password</span>");
    }

    -->

    HTML Code:


    his.pass.value)">

    <table>
    <tr>
    <td>Login box</td><td></td></tr>
    <tr>

    <td>Username: </td><td><input type="text" name="user" /></td>
    </tr>
    <tr>
    <td>Password: </td><td><input type="password" name="pass" /></td>
    </tr>
    <tr>
    <td colspan="4" align="left"><input type="submit" value="Login" /><input name="Lembrar" type="button" onclick="window.open('https://Main.html')" value="Lost your username?" /></td>
    </tr>
    </table>

    </form>


    AUTH.HTML ( CHECK OUR LOGIN )


    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
    <head>

    <script type="text/javascript">
    <!--

    var authstring = "<script type=\"text/javascript\" src=\"" + location.search.substring(1) + ".txt\"><\/script>";
    if (location.search) document.write(authstring);

    // -->
    </script>
    </head>
    <body>
    <script type="text/javascript">
    <!--
    window.auth ? location.replace(redirect) : location.replace("index.html?auth=failed");
    // -->
    </script>
    </body>
    </html>


    </script>




    so: i found this code ..but it' my 1 project ,, so hard to me lol

    http://www.htmlgoodies.com/beyond/ja...le.php/3471111

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles