Form - click button to new page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemong
    New Member
    • May 2007
    • 4

    Form - click button to new page

    Hi, wondering if anyone can help me
    I have created a form and user id, password that allows the user to submit and all this works fine however I want to create another button next to the ' > ' submit button within the form that customers can press that will direct them to a page called '/register.asp' button name 'Register' - however when I create this button it 'submits' the data

    See code below

    Grateful if anyone can offer any help
    Its a ork project that I have to finish asap
    Thanks Hemong
    [code=html]<form name="formLogin " method="post" onSubmit="javas cript:submitLog in(formLogin);" target="_blank" >
    User name
    <input type="text" name="username" class="input" size="20" />
    Password
    <input type="password" name="password" class="input" size="15" />
    <label>
    <input type="submit" name="submit" value=" &gt; " />
    </label>
    <label></label>
    <input type="submit" name="Submit" value="Register " /></a>
    </form>[/code]
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by hemong
    Hi, wondering if anyone can help me
    I have created a form and user id, password that allows the user to submit and all this works fine however I want to create another button next to the ' > ' submit button within the form that customers can press that will direct them to a page called '/register.asp' button name 'Register' - however when I create this button it 'submits' the data
    It certainly looks like you are trying to submit the data. Would you like it to do something else? Instead of type="submit" try type="button" then you will have to give it onClick code
    [code=html]
    onClick="window .location='regi ster.asp'"
    [/code]
    Or do you want to submit the data but to a different page?

    Jared

    Comment

    • hemong
      New Member
      • May 2007
      • 4

      #3
      Originally posted by jhardman
      It certainly looks like you are trying to submit the data. Would you like it to do something else? Instead of type="submit" try type="button" then you will have to give it onClick code
      [code=html]
      onClick="window .location='regi ster.asp'"
      [/code]
      Or do you want to submit the data but to a different page?

      Jared
      Hi Jared
      Thanks for the reply - I actually maybe in the wrong forum - firstimer, not really sure about things yet.
      I forgot to add the script before (see below)
      I have created a form that asks you for an ID Name and password to allow you to continue. However I also wanted a button when pressed sent you to another page (register.asp) so that a customer could register there details if they wanted to view the site. Hope this makes sense. I just want a customer to able to press a button that sends them to another page -
      Regards
      Hemong

      <script language="JavaS cript" type="text/JavaScript">
      <!--



      var mmWindow;
      function windowOpener() {
      if (!mmWindow || mmWindow.closed ){mmWindow=wind ow.open('where_ to_find_us.htm' ,'thewindow','w idth=650,height =570,top=10,lef t=50, resizable,menub ar,statusbar,to olbar,scrollbar s');}
      else{
      mmWindow.close( );
      mmWindow=window .open('where_to _find_us.htm',' thewindow','wid th=650,height=5 70,top=10,left= 50, resizable,menub ar,statusbar,to olbar, scrollbars');
      }
      }

      function setDomain() {
      var liBehindFirstDo t = document.domain .indexOf( "." ) + 1;
      if (liBehindFirstD ot > 0) {
      document.domain = document.domain .substr( liBehindFirstDo t );
      }
      }
      setDomain();

      function submitLogin(frm Login) {

      // Get username and password from user input

      var myLogin = new String(frmLogin .elements["username"].value);
      var myPassword = new String(frmLogin .elements["password"].value);

      // Check that both username and password are entered

      if (myLogin == "" || myPassword == "") {
      alert("Please enter a username and password");
      }
      else {
      // Login via javalogin

      // alias: username
      // password: password
      // contact: BOC contact department - Displayed if login fails
      // phone: BOC phone number - Displayed if login fails
      // logout_url: Logout url

      frmLogin.action = "https://pgw100.portal.g ases.boc.com/javalogin/javalogin.jsp?a lias=" + myLogin + "&password= " + myPassword + "&contact=B OC Customer Service&phone=0 800 111 333&logout_url= http://www.bocindustri al.co.uk";
      //frmLogin.submit ();
      }

      }

      function MM_preloadImage s() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
      var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0; i<a.length; i++)
      if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
      }
      //-->
      </script>

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Yeah, this is really more of an html question in my mind. Any input of type "submit" will submit the form. So I would definitely do this as I showed in my last post: use type="button" and then set an onClick attribute which sends you to the register page.

        Is this working for you now?

        Jared

        Comment

        • hemong
          New Member
          • May 2007
          • 4

          #5
          Originally posted by jhardman
          Yeah, this is really more of an html question in my mind. Any input of type "submit" will submit the form. So I would definitely do this as I showed in my last post: use type="button" and then set an onClick attribute which sends you to the register page.

          Is this working for you now?

          Jared
          Thanks I'll give it a try

          Comment

          Working...