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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Java Script to open html form in Resized Window

    Please excuse me if I got off topic. New to getting help for this java script option.

    I have created a simple html form, not fancy, I do have to admit it, the form can use some fancy sprucing up though.

    Scenario, I have a main html document, a home page. On the page I don't want to directly leave a form for a user to directly fill out, but on the home page, have a hyper link that opens to the basic form then the visitor can fill out the 3 items. The idea is that I don't want to use captcha either. I don't want the html page that has the form open directly into a whole page but open it up to the size of the form around the table or a little larger.

    Can that be done?

    Honestly, I've research this an can get some useful information. I found this website: http://www.webdeveloper.com/forum/sh...ize-using-HTML, that talks about this very same topic.

    I like it.

    My Question, with example 1 provided, how can I get the example of a basic window pop up, which is a legit pop up, nothing spamy about it or such, to work?

    The code that is provided is java script, but doesn't show how to place the code into the home page or exactly implement the java script to do what I need the form/window to do.

    Example 1: Create a Basic Popup Window

    The example code provided is this:

    [CODE]
    window.open‘win1.html’,‘Window1’,
    ‘menubar=no,width=430,height=360,toolbar=no’);
    [ICODE]

    But I don't know how to implement that code that was provided as an example. I believe the code needs tweaking, can you help? Simple, not elaborate?

    My basic html form:
    [CODE]
    <table border="2"><tr><td>
    <CENTER>
    <FORM METHOD=POST ACTION="mailto:blawblaw@widget.com" ENCTYPE="text/plain">
    <BR>&nbsp;Name:&nbsp;&nbsp;&nbsp;<INPUT TYPE="text">
    <BR>&nbsp;E-Mail:&nbsp;<INPUT TYPE="text">
    <BR>
    <TEXTAREA ROWS="12" cols="50">
    </TEXTAREA>
    <BR>
    <INPUT TYPE="submit" VALUE="Send">
    <INPUT TYPE="reset" VALUE="Clear">
    </FORM>
    </CENTER>
    <!-- END OF FORM -->
    </td></tr></table>
    [ICODE]

    v/r Booga73

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,695
    Thanks
    80
    Thanked 4,511 Times in 4,475 Posts
    Well, just for starters, your <form> isn't going to work for many (if not most) people.

    <form action="mailto:..."> is (a) obsolete, as many browsers now will *NOT* send the form contents and (b) even on browsers that will do so, it depends on whether the user has his/her mail client linked to the browser and (c) even with all that, the browsers (maybe 25% of them?) that will still email a form for you will prompt the user with dire warnings about how unsafe this is, thus scaring off maybe half such users. So all in all, this means that IF YOU ARE LUCKY your code will work for *maybe* 20% of your visitors.

    You need to, instead, use SERVER-based email. PHP or JSP or ASP or CGI, whatever your web host provides.

    ************

    Regarding the popup: I give up, what is wrong with using window.open( ) as you showed? *WHY* don't you like that?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,170
    Thanks
    203
    Thanked 2,549 Times in 2,527 Posts
    window.open‘win1.html’,‘Window1’,
    ‘menubar=no,width=430,height=360,toolbar=no’);

    See something missing? Also you seem to have used "literary" or typographer’s quotes as used in a word processor such as MS WORD. These are not valid characters in Javascript. You must create your js and HTML code in a text editor, and use ordinary quotes ' and ".

    As Old Pedant has pointed out, the trouble with using this long-obsolete method (mailto) to send form results is its unpredictability. The method it is highly dependent on the browser in use and the email client in use (some people have only Yahoo, Gmail or Hotmail). In particular, your visitor must have Outlook or Outlook Express or Windows Live Mail as the default client for this to work correctly. Even if your visitor is using Internet Explorer, but the default mail client is different (e.g. Eudora or Thunderbird), your mailto form will not work. With all of the browser troubles, you're likely to lose about half of your users' messages. Most of the email clients that can successfully send a mail will prompt the user with a somewhat threatening security dialog prior to sending - this can scare many users from continuing. Other users will not wish to reveal their email address. Also, what about people with Javascript disabled?

    In addition, if you place an unobfuscated email address in your webpage, the bots will quickly find it and inundate you in spam.

    Modern browsers no longer accept mailto: as a form action - they simply open the email program (if any) and ignore the form. If you are going to use a form then use a server-side CGI formmail script as the action - there are several good free ones out there.

    For a simple PHP form feedback script see:- http://www.thesitewizard.com/archive/feedbackphp.shtml
    or http://www.felgall.com/php2.htm
    Last edited by Philip M; 03-21-2013 at 08:52 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,695
    Thanks
    80
    Thanked 4,511 Times in 4,475 Posts
    Last but not least, your <form> won't work, anyway.

    *ONLY* form fields that have *NAMES* will be sent by the browser.

    NOT ONE of your form fields has a name, so none of them would ever be sent, no matter what.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you for that insight, will look into those options PHP or JSP or ASP or CGI.

    best regards,

    Quote Originally Posted by Old Pedant View Post
    Well, just for starters, your <form> isn't going to work for many (if not most) people.

    <form action="mailto:..."> is (a) obsolete, as many browsers now will *NOT* send the form contents and (b) even on browsers that will do so, it depends on whether the user has his/her mail client linked to the browser and (c) even with all that, the browsers (maybe 25% of them?) that will still email a form for you will prompt the user with dire warnings about how unsafe this is, thus scaring off maybe half such users. So all in all, this means that IF YOU ARE LUCKY your code will work for *maybe* 20% of your visitors.

    You need to, instead, use SERVER-based email. PHP or JSP or ASP or CGI, whatever your web host provides.

    ************

    Regarding the popup: I give up, what is wrong with using window.open( ) as you showed? *WHY* don't you like that?


  •  

    Posting Permissions

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