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

Thread: how to invoke javascrupt openwindow from html <form>

  1. #1
    Join Date
    Nov 2013
    Posts
    15

    how to invoke javascrupt openwindow from html <form>

    I want to go to a new window from a form, but I don't see how to position the JS so the parameters are passed.
    This doesn't work:
    <form action=javascriptpWin("http://test.com")>
    <input type=hidden etc.></form>

    How can I pass the <form> parameters?

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,364

  3. #3
    Join Date
    Nov 2013
    Posts
    15
    These really don't answer my question. I know how to open a window.
    My questions was how to do it from a <form>. I.e. how to get the <form> parameters properly associated with the open function? Thanks.

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,364
    Why?

    You seem to have a way that works
    and another that does not.

    What do you believe would be the advantage to use a <form>?

  5. #5
    Join Date
    Nov 2013
    Posts
    15
    Why do I want to use <form>? Because what I'm doing requires <form>, requires input data. How else would I do input data without <form>? I can open a new window via <a href> but then I wouldn't have input fields. I do not have a way that works. Is there an answer to my question?

  6. #6
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,364

    Question

    Show some code or provide a live link to your problem.
    Perhaps there is a better way to accomplish your desire.

    You can open an existing site with an included form (with inputs).
    You can create a page with the form and inputs on the fly.
    I don't understand your need to do it via a submit event.

  7. #7
    Join Date
    Nov 2013
    Posts
    15
    Do you really not understand why anyone would want to go from a <form> directly to a new window?
    It's very simple - the form asks for parameters to be used in generating the new window.
    My specifics don't matter. Just answer the question of how I go from a form to a new window - with parameters from the form. Envision a simple form that gets one input and wants to open the next script in a new window passing the input. That's all I need. If it can't be done, tell me that.

    I should add that I currently do it with an intermediate step - "Continue?" so I can pass parameters with "<a href=javascript:function()>" But the Continue step should not be necessary.
    Last edited by zron; 11-29-2013 at 07:02 PM.

  8. #8
    Join Date
    Nov 2013
    Posts
    15
    xx
    Last edited by zron; 11-29-2013 at 07:03 PM. Reason: delete

  9. #9
    Join Date
    Oct 2013
    Posts
    457
    I think you need to define what "parameters" you want to pass to the new window/page. URL obviously, but scrollbars? Window size? Menubar? Other? That's going to determine what inputs you need, hidden or not, in your form. It will also determine what needs to be in your JavaScript.

  10. #10
    Join Date
    Nov 2013
    Posts
    15
    Sorry, thought I was clear. By parameters I mean the input from the form used by the subsequent application. This application is about dog shows - to give you context, lets say a small window asks "what states do you want to see shows from?" and it loads a big window with a list of dog shows in the indicated states. (It's much ore complex than that, but I'm trying to keep the example simple.)

    I don't need help with the JS-level parameters you mention above.

  11. #11
    Join Date
    Oct 2013
    Posts
    457
    So, to help me wrap my pea-brain around this, and to extend your analogy, let's assume you have a list of all dog show in the USA in 2014. You would like a user to input via your form "I want to see all the dog shows in Idaho in February 2014" (just an example), and have your results window/page open with all those dog shows. Is that a reasonable representation of what you want to happen?

  12. #12
    Join Date
    Nov 2013
    Posts
    15
    Yes - but the application really isn't the issue. Don't try to suggest different ways to do my application!
    Can't someone just answer the question of how to go from a <form> to a new window with the form parameters (<input>, submit, select, radio, hidden, etc) passed properly? Give me just a simple example with one parameter.

  13. #13
    Join Date
    Oct 2013
    Posts
    457
    The reason I asked the stupid question is

    1. Yes it's possible to open a window with JavaScript but
    2. JavaScript isn't going to pull your parameters or pass those parameters to a new window without a lot of help


    You basically have a database of dog shows. You will need a server-side solution to display the results of a database query. That involves, probably, MySQL and PHP. Now, JavaScript can open a new window to display the results of that query, but it can't make the query because it's a client-side language. In other words, JS only works on the user's computer, not the server.

  14. #14
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,364
    Thank you, I have given up trying to communicate with this guy!

  15. #15
    Join Date
    Jan 2014
    Posts
    5
    This is the mostly used way. As
    <form action="javascript:window.open("www.myonlinemela.blogspot.com")>

Thread Information

Users Browsing this Thread

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

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