Posting input fields outside of a form

Discussion in 'Javascript' started by Otto Wyss, Mar 26, 2007.

  1. Otto Wyss

    Otto Wyss Guest

    It's possible to declare inbut fields outside of a form, is it possible
    to post these values to the server? E.g. attach them to the posted form?

    O. Wyss
     
    Otto Wyss, Mar 26, 2007
    #1
    1. Advertisements

  2. Otto Wyss

    RobG Guest

    Possible? Yes, use script to write their values to form controls that
    are submitted. But why make submission dependent on scripting?
     
    RobG, Mar 26, 2007
    #2
    1. Advertisements

  3. Otto Wyss

    -Lost Guest

    Or you can retrieve their values, then post them to the server via an XMLHttpRequest.

    However, this is not at all appropriate. You would need the entire *valid* form for those
    who did not have JavaScript enabled. This allows those who do not have JavaScript enabled
    to submit the form. Those who do have JavaScript enabled, well, you get the point.

    -Lost
     
    -Lost, Mar 27, 2007
    #3
  4. Otto Wyss

    RobG Guest

    That would not be attached "to the posted form", it would be a
    separate request and likely to fail in a greater number of browsers
    (though how much greater I'm not going to guess :) ).

    If the OP's intention is to send the data without posting a form, then
    script can be used to append the data to the search string of the URI
    for an image, script file, hidden iFrame or page, or any other request
    to the server - there is no need to rely on browser support for
    XMLHttpRequest.

    ACK.
     
    RobG, Mar 27, 2007
    #4
  5. Otto Wyss

    Otto Wyss Guest

    My intention is to post a form but to attach all the input fields of the
    following table with this posted form. Yet I don't want to include the
    table into the form because of layout reasons.

    O. Wyss
     
    Otto Wyss, Mar 27, 2007
    #5
  6. Otto Wyss

    RobG Guest

    Form is a block element that can have almost anything inside it, I'm
    confident you can achieve a good layout using a form for all your
    input fields. It may not be what you have now, but it can be just (or
    more) functional for users and not subject to the whims of scripting.

    If you have layout issues, discuss them in an HTML or CSS group - they
    will want a link to a sample page:

    news:comp.infosystems.www.authoring.html
    <URL: http://groups.google.com.au/group/comp.infosystems.www.authoring.html?lnk=li
    news:comp.infosystems.www.authoring.stylesheets
    <URL: http://groups.google.com.au/group/comp.infosystems.www.authoring.stylesheets?lnk=li
     
    RobG, Mar 28, 2007
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.