Hello!

You can do it in many ways:

1. Create an empty placeholder for hidden input (div at the bottom of your 
form). You can then easily replace content of this div and don't care about 
multiple inputs:

addElement: function () {
    $("totalsContainer").update('<input type="hidden" id="finaltons" 
value="' + totaltotal + '"></input>');
}

2. Create this hidden input in your form on server (in other words, input 
should always exist), then just replace its value:

addElement: function () {
    $("finaltons").setValue(totaltotal);
}

3. Combine both ways: check for existence of element (if not exists - then 
create it), then update its value:

addElement: function () {
    var input = $("finaltons");
    if (!input) {
      input = new Element({type: "hidden", id: "finaltons"});
      $("formtons").insert(input);
    }
    input.setValue(totaltotal);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/kcV7l5b_sIIJ.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to