Thanks Jeffrey, Glen, Steve, Gordon and Erik

Sorry it took so long to reply, I was steeped in development work which can (finally) go live tomorrow.

The reason I was trying to do this was as part of the checkout form for a shopping platform. I have 2 sets of address fields, one for delivery and one for billing, so I put a show/hide effect on the billing address when the user answered the question 'Is your billing addess the same as your delivery address?'. It was due in part to the way the cms remembers the values of form fields that I had to replicate the address fields I was hiding and then set their values to blank so that they would over-ride the values stored on the server. Bit of a hack unfortunately.

Because of time constraints I created a workaround similar to the code that Jeffrey kindly provided.

The following gave me a set of elements I could dynamically swap for the actual text fields:

var hiddenAddrInputs = '';
$(".billing-address input").clone().each(function(){
        hiddenAddrInputs +=  '<input type="hidden" name="' + $(this).attr("name") + '" 
value="" />';
})
var hiddenAddr = $(hiddenAddrInputs);


Thanks again guys, I learned something new at least!

Rob

Reply via email to