Hi, I have a moderate level of experience with javascript, and a good
oo background. So, when I tried jquery I'm really liking it.

I have a requirement to add input fields dynamically to the form since
I don't know ahead of time how many entries the user may request. I
was able to implement this with jquery very quickly with a small
amount of code.

When the form is submitted it is sent to the server with all of the
data correctly passed. However, if I do a refresh, the dynamic fields
go away, but the static fields still have data in them so I assuming
that the dynamic data is still there.

How can I verify this? When I show source, it only shows the original
code; same even before the form is submitted. Is there a way to stop a
refresh? This application may have 10 added fields or 300 added
fields, and if the user does a refresh for some reason he'll want to
see every thing that has been input so far.

my code:
$(document).ready(function() {
    $("#divBoxes input:last").bind("change", appendBoxField);
    $("#divBags input:last").bind("change", appendBagField);
});
function appendBoxField() {
    var len = $("#divBoxes input").length + 1;
    //alert(len);
    $("#divBoxes").append('<input type="text"
name="_UPS_Shipping_Label_' + len + '" />')
    $(this).unbind("change", appendBoxField);
    $("#divBoxes input:last").bind("change", appendBoxField).focus();
}
function appendBagField() {
    var len = $("#divBags input").length + 1;
    //alert(len);
    $("#divBags").append('<input type="text" name="_photo_bag_ID_' +
len + '" />')
    $(this).unbind("change", appendBagField);
    $("#divBags input:last").bind("change", appendBagField).focus();
}



Thanks,

Terry

Reply via email to