SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with hidden tables in Internet Explorer

    Hi,

    I am developing a website that uses a hidden table in a form to pass data by post to the next (php) page. It uses the Javascript function (see below). I have used alert to check the variables delivery_cost and delivery_status are both as they should be. Also this works fine in Firefox but fails to pass the data in Internet Explorer.....any help / work around would be appreciated.
    ============================================================
    function hidden_delivery(delivery_cost,delivery_status)
    {
    delornot.value = delivery_status;
    delcost.value = delivery_cost;
    }
    ============================================================
    Thanks

    Terry

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,682
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by tezzamatic View Post
    Hi,

    I am developing a website that uses a hidden table in a form to pass data by post to the next (php) page. It uses the Javascript function (see below). I have used alert to check the variables delivery_cost and delivery_status are both as they should be. Also this works fine in Firefox but fails to pass the data in Internet Explorer.....any help / work around would be appreciated.
    ============================================================
    function hidden_delivery(delivery_cost,delivery_status)
    {
    delornot.value = delivery_status;
    delcost.value = delivery_cost;
    }
    ============================================================
    Thanks

    Terry
    Where have you declared what the delornot and delcost variables are?

    If you have a form with an identifier:

    HTML Code:
    <form id="descriptiveidentifieraboutform" method="post" action="page2.php">
        <input name="delornot" type="hidden">
        <input name="delcost" type="hidden">
        ...
    </form>
    You can use the form to easily access the form elements within it. JavaScript has an elements property on forms which is used for that.

    Code javascript:
    function hidden_delivery(form, delivery_cost, delivery_status) {
        form.elements.delornot.value = delivery_status;
        form.elements.delcost.value = delivery_cost;
    }
     
    var form = document.getElementById('descriptiveidentifieraboutform'),
        cost = ...,
        status = ...;
    hidden_delivery(form, cost, status);
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks... works like a dream, and I learned a bit.

    terry


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
  •