Is it possible to pass the values of variables obtained in my javascript code executing before the ajax call to the script i execute after the ajax call returns?
basically i have a dynamic form that gets new elements based on some logic depending on what the user clicks. The form has some text input fields that they can fill in as they customize the form...but the problem is that anything they type in gets forgotten when the form is updated with a new element (because i completely reconstruct the form with each element added). What im attempting to do in the script that executes before the ajax call is to read in all the values of each input field. then, when the ajax call returns and the form is regenerated, i want to fill in the fields with the values they had before the call. hopefully thats not too confusing and someone can point me in the right direction. thanks! heres the code i have: echo $ajax->link("link", array('controller' => 'units', 'action' => 'getUnits', $unit['Unit']['id']), array('update' => 'builder', 'before' => ' var notes = new Array (); if(document.build_form) { for(var i=0; i < document.build_form.elements.length;i++){ if (document.build_form.elements[i].name.substr(0,4) == "note"){ notes.push(document.build_form.elements[i].value); } } } notes.reverse(); ', 'after' => ' var note = ""; if(document.build_form) { for(var j=0; j<document.build_form.elements.length;j++){ if (document.build_form.elements[j].name.substr(0,4) == "note"){ note = notes.pop(); if(note) document.build_form.elements[j].value = note; } } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---