SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Guru
    Join Date
    Oct 1999
    Location
    New York, NY
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow pop-up window from a form?

    Hi --

    When visitors subscribe to my mailing list, instead of the "Subscription Successful" window appearing, how can I get the submit button to create a small pop-up window that says "Subscription Successful"?

    Is this possible?! Right now, my input code is <input type="submit" name="Submit" value="go">

    Thanks.

    Josh

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the way Gamespy does it on their Daily Victim page:

    Code:
    <FORM NAME="voteandview">
    <input type="radio" name="score" value="1">
    <input type="radio" name="score" value="2">
    
    <SCRIPT LANGUAGE="Javascript">
    <!--
    function Vote() {
    	url = "your URL here";
    	count = 0;
    	while (document.voteandview.score[count].checked != true) {
    		count++;
    	}
    	url += "&vote=" + document.voteandview.score[count].value;
    	ipwindow = open("","prewindow","scrollbars=no,toolbar=no,height=410,width=500");
    	ipwindow.location.href = url;
    }
    
    function Results() {
    	url = "your URL here";
    	ipwindow = open("","prewindow","scrollbars=yes,toolbar=no,height=410,width=500");
    	ipwindow.location.href = url;
    }
    
    // -->
    </SCRIPT>
    	<INPUT TYPE="button" NAME="bVote" VALUE="Vote" ONCLICK="Vote()">
    <INPUT TYPE="button" NAME="bView" VALUE="Results" ONCLICK="Results()">
    </FORM>
    Last edited by creole; May 14, 2002 at 13:59.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Guru
    Join Date
    Oct 1999
    Location
    New York, NY
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh.

    Is there not a 'simpler' way to achieve that goal?! I was hoping it was perhaps an additional html element added to the input tag?!?

    Thanks!

    Josh

  4. #4
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nah, you'll have to use something like that... HTML is not really that powerful, it's only a markup language, javascript would be your best bet.

  5. #5
    SitePoint Guru
    Join Date
    Oct 1999
    Location
    New York, NY
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply.

    Basically, I want to achieve the same effect as adding the "target=new" tag to a standard link which would launch a new window. I just want to launch a new window when my 'submit' button is pressed in a form.

    Josh

  6. #6
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    couldnt you just use javascript onClick and open a popup?
    Wavelan

  7. #7
    SitePoint Guru
    Join Date
    Oct 1999
    Location
    New York, NY
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes! If that would work, that's what I'm looking for. Where would I add that in my <form> html tag? And could you please provide my with the OnClick html to add (I'm not certain of it!)?

    Thanks.

    Josh

  8. #8
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok well on your submit button:

    Code:
    <input type="submit" onclick="openWin('test.htm','Test',100,100)">
    Then put this in your header (or above the input):
    Code:
    <script type="text/JavaScript">
    <!--
    function openWin(href,title,w,h){
    window.open(href,title,'toolbar=no,status=no,resize=yes,width=' + w + ',height=' + h);
    }
    
    //-->
    </script>
    That should work if not post again, if its even what you want to accomplish
    Wavelan

  9. #9
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Um... <form method="post" action="myaction.asp" target="_blank"> doesn't work?
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  10. #10
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    As far as I know, target="_blank" WILL work. I've used it on one of my older sites.
    Mike
    It's not who I am underneath, but what I do that defines me.

  11. #11
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It does, I tested it right after writing that post
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  12. #12
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    might be not what you want...

    This might not be what you want, but it shows how a form on a main page can interact with a pop-up window, displaying the execution results of that form along with it.

    Probably for archiving purposes anyway.

    As with all pop-ups, there's a fair bit of javascript. But this is all there is.

    Code:
    <script language="JavaScript">
    function updateLog() {
        window.open("about:blank","Window","width=600,height=400,scrollbars=yes");
        document.updateLogForm.submit();
        updateLogForm.version.value = ""
        updateLogForm.details.value = ""
    }
    </script>
    The code for the <form> element

    Code:
    <form action="urltofile.ext" method="post" name="updateLogForm" target="Window">
    And finally the submit button
    Code:
    <input type="button" value=" Add " onClick="updateLog()">
    Note the names, updateLogForm, Window and updateLog. Those are critical in the cohesion of this application.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  13. #13
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This does pretty much the same thing, the only thing I would change would be move the onclick to the <form> and make it an onSubmit, that way users don't need to click on the button to finish the operation
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  14. #14
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jeremy, i was going to say that too
    additionally, i would do something like this (using the previously posted code):
    Code:
    <script language="JavaScript">
    function updateLog() {
        window.open("urltofile.ext","Window","width=600,height=400,scrollbars=yes");
        document.updateLogForm.submit();
        updateLogForm.version.value = ""
        updateLogForm.details.value = ""
    }
    </script>
    
    <form action="urltofile.ext" method="post" name="updateLogForm" target="Window" onSubmit="updatelog();return false">
    note that i put urltofile.ext in the updatelog function. also, return false in the onSubmit.
    if i'm not mistaken, the effect of this will be:

    -if user has javascript ("normal" surfer) the updatelog function kicks in, opens the popup. the return false prevents the form from being processed normally by the browser (i.e. it won't pop up AND then submit again)
    -if user has no javascript (turned off in the browser or using non-javascript-capable one like lynx or something), the form is processed as normal and the browser (not javascript) opens a new window named "Window" unless there's already one there

    sorry, explanation ended up being longer than anticipated. hope i didn't just state the obvious...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com


Bookmarks

Posting Permissions

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