Question

I've got a .phtml form which allows a user to select from a box a quantity of boxes ranging from 1 to 5.

Depending on the value selected, I use JS to call a PHP method using Ajax to print dimension fields for these boxes which the user is then required to fill in.

for ($counter = 0; $counter < $boxes; $counter++){
        if ($counter%2==0){
            echo "<tr class=\"even pointer\">";
        }
        else{
            echo "<tr class=\"pointer\">";
        }
        echo "<td>" . ($counter+1) . "</td>
              <td class=\"value\"><select name=\"dispatch_parcel_" . $counter . "_type\" id=\"dispatch_parcel_" . $counter . "_type\" style=\"width:138px\">" . $this->getBoxTypes() . "</select></td>
              <td class=\"value\"><input name=\"dispatch_parcel_" . $counter . "_length\" id=\"dispatch_parcel_" . $counter . "_length\" value=\"n/a\" disabled/></td>
              <td class=\"value\"><input name=\"dispatch_parcel_" . $counter . "_width\" id=\"dispatch_parcel_" . $counter . "_width\" value=\"n/a\" disabled/></td>
              <td class=\"value\"><input name=\"dispatch_parcel_" . $counter . "_height\" id=\"dispatch_parcel_" . $counter . "_height\" value=\"n/a\" disabled/></td>
              <td class=\"value\"><input name=\"dispatch_parcel_" . $counter . "_weight\" id=\"dispatch_parcel_" . $counter . "_weight\" value=\"n/a\" disabled/></td></tr>";
    }

Up until this point everything works 100%.

This is all printed into a div within the existing form. After the div field, there is a submit button which calls a method to do calculations based on these dimensions.

However, when trying to $_GET the value of the input elements printed above, I am getting an error as follows

Notice: Undefined index: dispatch_parcel_0_length in /chroot/home/[mysite][/[mysite]html/app/code/local/[mynamespace]/[mymodule]/controllers/Adminhtml/[mycontroler].php

(I get similar errors trying to fetch any other of the printed elements' content)

I have quadruple checked that:

-The exact element does exist with firebug & chrome-dev-tools

-The form's method is get and,

-The div in which the elements are printed is within the form's fieldset.

Would really appreciate some input - thanks very much in advance.

Was it helpful?

Solution

disabled elements are not send, try using readonly

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top