Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: form actions

  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation form actions

    hello i have written a form with the action as a javascript see below
    but what i need to do is when the form is submitted i need the page with the form to stay exactaly as it is and not change when i click on the submit button can someonr help me please

    code:

    <form method="post" action="javascript:window.open('postinfo.php', 'helpwindow', config='height=300, width=600,
    toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no,
    directories=no, status=no')">

  • #2
    New to the CF scene
    Join Date
    May 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    i found the solution:
    <script>
    function createTarget(){
    var fn = document.sampleform.name.value;
    var fgn = document.sampleform.gamename.value;
    var mail = document.sampleform.email.value;
    var y = document.sampleform.why.value;
    var msn = document.sampleform.msn.value;
    var loc = document.sampleform.location.value;
    var saber = document.sampleform.saber.value;
    var age = document.sampleform.formage.value;
    var add = document.sampleform.addinf.value;
    var place = "postinfo.php?name="+fn+"&gamename="+fgn+"&email="+mail+"&why="+y+"&msn="+msn+"&location="+loc+"&sab er="+saber+"&formage="+age+"&addinf="+add+"";
    window.open(place, 'target', 'height=300', 'width=600', 'toolbar=no', 'menubar=no', 'scrollbars=yes', 'resizable=no', 'location=no', 'directories=no', 'status=no');
    return true;
    }
    </script>

    <form name="sampleform">
    inputs an stuff
    <input type=submit value="Submit to RK" onclick="return createTarget()">

    but i had to make it so that when the page refreshed the details of the form were carried over by a syntax

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    This is a much simpler solution. No need to manually post the data.
    Code:
    function createTarget(target){
      var w = window.open('', target, 'height=300', 'width=600', 'toolbar=no', 'menubar=no', 'scrollbars=yes', 'resizable=no', 'location=no', 'directories=no', 'status=no');
      w.focus();
    }
    ...
    <form name="sampleform" action="postinfo.php" target="popup" onsubmit="createTarget(this.target)">
    inputs and stuff
    <input type="submit" value="Submit to RK" />
    </form>


  •  

    Posting Permissions

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