www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Need pop up - post form fill out help

Hybrid View

  1. #1
    Join Date
    Sep 2013
    Posts
    4

    Need pop up - post form fill out help

    The problem I have is that I have some existing form code that is redirecting to a page and I need to create a pop up instead of a redirect. I am use to using an onClick popup on an a href tag but not sure how with form elements. My goal is to direct to a pop up after the user submits.

    Here is my existing code:

    <form class="lpeRegForm formNotEmpty" method="post" enctype="application/x-www-form-urlencoded"
    action="http://info.getsatisfaction.com/index.php/leadCapture/save" id="mktForm_1003" name="mktForm_1003">
    <input type="email" name="Email" id="Email" placeholder="enter email address" maxlenght="255" style="width:260px;" class="input white-btn">
    <input type="submit" name="submit" value="Submit" onclick='Mkto.formSubmit(document.getElementById("mktForm_1003")); return false;' class="btn light-gray-btn right">

    <input type="hidden" name="lpId" value="1025" />
    <input type="hidden" name="subId" value="45" />
    <input type="hidden" name="kw" value="" />
    <input type="hidden" name="cr" value="" />
    <input type="hidden" name="searchstr" value="" />

    <input type="hidden" name="formid" value="1003" />
    <input type="hidden" name="returnURL" value="http://info.getsatisfaction.com/newsletterthankyou.html" />
    <input type="hidden" name="retURL" value="http://info.getsatisfaction.com/newsletterthankyou.html" />

    <input type="hidden" name="_mkt_disp" value="return" />
    <input type="hidden" name="_mkt_trk" value="id:485-EJB-147&token:_mch-getsatisfaction.com-1284653444685-81494" />
    </form>

  2. #2
    Join Date
    Sep 2013
    Posts
    17
    Yeah, I know this is the Javascript section, but you could really do this nicely with php.

    I'm going to post an example (or rather part) of a pop-out error box for one of my forms here.
    It shows or doesn't show the error box (div) depending via an if statement and the CSS visibility attribute.
    An important aspect of this is that I'm posting the form to the page the form is on.
    $warn_vis is the pop-out div.
    //This goes before the <!DOCTYPE...>
    <?php
    if($_POST['submitted'] == 1){$warn_vis='visibility:hidden;';}
    //Or, alternately, you could do something like this here:
    if(($errors == 0) && ($_POST['submitted'] == 1))
    {header("Locationopout.php");}
    ?>
    <body>
    <div style=" <?php echo $warn_vis ?> "><table style="background-color:white; border:1px solid gray; float:left; position:absolute; z-index:2; top:345px; left:500px; height: 78px; width:310px; text-align:center; vertical-align:middle;">
    <tr><td style="font-family: Tahoma, Geneva, sans-serif; font-size: 11px; padding-bottom:1px;padding-top:0px;">Whatever you want to say in your popout after a successful submission!</td></tr></table></div>
    </body>
    </html>

  3. #3
    Join Date
    Sep 2013
    Posts
    17
    Oky Doky, I've found the "disable smileys" button.
    Still don't see any way to edit my posts.
    This thing is still acting like 40 tons of lead though.

    Anyway, what you probably are really looking for is JS "onsubmit".

    http://www.w3schools.com/jsref/event_form_onsubmit.asp

  4. #4
    Join Date
    Sep 2013
    Posts
    17
    As you probably already know, that whole speil has to be on one line with no returns for it to work.
    Just a heads up.

  5. #5
    Join Date
    Sep 2013
    Posts
    17
    Pardon me,
    $warn_vis is actually the pop-out div's style.

    Off the subject, can someone tell me a few things?
    I'm new here, but I'm wondering why this "webdev" site downloads like I'm trying to push a battlship through a garden hose?
    And where the heck are the controls for this thing? I can't even turn the smileys off (refer to my response above).
    More importantly, I can't find a button to hit to edit my posts.
    And, why the heck is the home page broken in IE8?
    I would have thought a "webdev" site (expecially with the kind of high traffic the would have been tweeked a little bit better than this. Comments?

  6. #6
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,674
    Quote Originally Posted by c-cat View Post
    ... I can't even turn the smileys off (refer to my response above)...
    if you had been using the proper tags for posting your code no smileys were in it

  7. #7
    Join Date
    Sep 2013
    Posts
    17
    Can't edit, so I have to waste space to assist.

    onsubmit="window.open(this.href, 'mywindow', 'width=334,height=100,top=100px,left=550px,toolbar=no,location=no,directories=no,status=no,menubar=n o,scrollbars=no,copyhistory=no,resizable=no'); return false;" href="http://info.getsatisfaction.com/newsletterthankyou.html" target="_blank

    Adjust dimensions as needed.

  8. #8
    Join Date
    Sep 2013
    Posts
    4

    This may work, but need more direction.

    Quote Originally Posted by c-cat View Post
    Can't edit, so I have to waste space to assist.

    onsubmit="window.open(this.href, 'mywindow', 'width=334,height=100,top=100px,left=550px,toolbar=no,location=no,directories=no,status=no,menubar=n o,scrollbars=no,copyhistory=no,resizable=no'); return false;" href="http://info.getsatisfaction.com/newsletterthankyou.html" target="_blank

    Adjust dimensions as needed.
    I wasn't sure where to put this in my existing code. I already knew how to use this type of popup. I don't want to ruin the integrity of the tracking I have either. Thanks!

  9. #9
    Join Date
    Sep 2013
    Posts
    17
    Code:
    <form class="lpeRegForm formNotEmpty" method="post" enctype="application/x-www-form-urlencoded"
    action="http://info.getsatisfaction.com/index.php/leadCapture/save" id="mktForm_1003" name="mktForm_1003">
    <input type="email" name="Email" id="Email" placeholder="enter email address" maxlenght="255" style="width:260px;" class="input white-btn">
    <input type="submit" name="submit" value="Submit"
    onsubmit="window.open(this.href, 'mywindow', 'width=334,height=100,top=100px,left=550px,toolbar=no,location=no,directories=no,status=no,menubar=n o,scrollbars=no,copyhistory=no,resizable=no'); return false;"href="http://info.getsatisfaction.com/newsletterthankyou.html" target="_blank
    The part in red has to be on ONE line in your code view. Should work well. I'm not really sure what you mean about messing up your tracking. If you're refering to your hidden inputs and this messes that up, you'll have to see if you can use them in another way to track your visitors. It's possible. 'twould be very possible with a bit of php.

    Padonak - Are you telling me this is a place where I have to actually think? Oh, boy, I may definately be in the wrong place!

  10. #10
    Join Date
    Sep 2013
    Posts
    17
    Wow, that didn't work to well.
    The site froze on me (again!), and when I got it moving again, it posted and truncated my code!
    What the heck is up with that tiny tiny code box width? EGAD!
    How bouts we do this instead...
    code:

    <form class="lpeRegForm formNotEmpty" method="post" enctype="application/x-www-form-urlencoded"
    action="http://info.getsatisfaction.com/index.php/leadCapture/save" id="mktForm_1003" name="mktForm_1003">
    <input type="email" name="Email" id="Email" placeholder="enter email address" maxlenght="255" style="width:260px;" class="input white-btn">
    <input type="submit" name="submit" value="Submit"
    onsubmit="window.open(this.href, 'mywindow', 'width=334,height=100,top=100px,left=550px,toolbar=no,location=no,directories=no,status=no,menubar=n o,scrollbars=no,copyhistory=no,resizable=no'); return false;"
    href="http://info.getsatisfaction.com/newsletterthankyou.html" target="_blank">

    End of code.

    And I see the tracking (token) you're talking about. I'm not terribly familiar with that, but it should still work for you as it is with or without the new code.

  11. #11
    Join Date
    Sep 2013
    Posts
    17
    Well, I bounced around in here a bit and found that the site has been hacked and was down for a while recently. That may explain a lot. Mybad?
    I was a very active member of webdevforums.com when they got hacked several times a couple of years or so ago. They gave up after a couple of re-installs and were down for several months. It was a quality site and an immensly valuable resource that was reduced to nothing but a spam pit. It's a shame.
    I have NOT seen a single mod badge show up on that site since it went down. Everyone ran away. It took till now to have even a few seemingly knowledgable folk sneak back in to join. My own machines were not affected by whatever took them down, but it doesn't take much to spread the histeria.
    The site still operates with no-one and I mean NO-ONE at the wheel in spite of itself. The last message from a mod there was dated 2008. A-freeking-mazing.

    So, I guess I'll show my age and show a little patience. But yeah guys, the way this thing is acting, there's weeds to be pulled.

  12. #12
    Join Date
    Sep 2013
    Posts
    4
    Thanks for the help so far!!! Unfortunately it still won't work. Here is the final version I am using:

    <form class="lpeRegForm formNotEmpty" method="post" enctype="application/x-www-form-urlencoded"
    action="http://info.getsatisfaction.com/index.php/leadCapture/save" id="mktForm_1003" name="mktForm_1003">
    <input type="email" name="Email" id="Email" placeholder="enter email address" maxlenght="255" style="width:260px;" class="input">
    <input type="submit" name="submit" value="Submit"
    onsubmit="window.open(this.href, 'mywindow', 'width=670,height=500,top=100px, toolbar=no,location=no,directories=no,status=no,menubar=n o,scrollbars=no,copyhistory=no,resizable=no'); return false;"href="http://info.getsatisfaction.com/2013_Newsletter_Signup_Content.html?lsd=2013_Dummies_Book_Campaign&trk=Newsletter_Dummies_Download" target="_blank" class="white-btn">

    Not sure what the issue is. Maybe you can test and see if it works for you. Thanks again!

  13. #13
    Join Date
    Sep 2013
    Posts
    17
    I went over it and found that this site screwed the post up again.
    "director ies" should be "directories"

    Let me know.
    Cheers.

  14. #14
    Join Date
    Sep 2013
    Posts
    17
    I googled. This code should do it. I tested a simple version of it in one of my pages and it worked like a champ.
    Again, the red section must be all on one line of code.
    I tweaked it and modified your code with it: If it doesn't work, go over the syntax. I probably forgot a double quote or something stupid like that.

    <form class="lpeRegForm formNotEmpty" method="post" enctype="application/x-www-form-urlencoded"
    action="http://info.getsatisfaction.com/index.php/leadCapture/save" id="mktForm_1003" name="mktForm_1003" target="popup_win"
    onSubmit="window.open('','popup_win','width=670,height=500,top=100px,toolbar=no,location=no,director ies=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no')">
    <input type="email" name="Email" id="Email" placeholder="enter email address" maxlenght="255" style="width:260px;" class="input">
    <input type="submit" name="submit" value="Submit">

  15. #15
    Join Date
    Sep 2013
    Posts
    17
    I just realized that you're trying to send your data to one page for processing and show a different page in the popup window.
    I don't think you'll be able to do that. I already tried quite a few ways.
    Your best option is to combine the two pages: process your data on "...yada_yada=Newsletter_Dummies_Download"
    and show it in your popup or post the page to itself (PHP) and throw a header page via something like" if($submitted == 1){}.
    The next option is to pop an alert in addition to your popup window by putting both commands in your onsubmit statement.
    The thing that I do (I love PHP) is have the page post the data to itself and pop out a div or span via a php "if" statement
    and display: or visibility: like I showed in a previous reply.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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