Click to See Complete Forum and Search --> : Non-PHP Ajax Question (flame on...)


lazzerous
07-14-2008, 12:38 PM
Go ahead - rip me a new one because This isn't PHP related. I have my titanium underoos strapped on tight.

I have a form on one page.
On that page is a link that makes an ajax call to add another form to a div.
I am trying to pass values from the form in the ajax call back to the parent form.

Within the form called via ajax:
$display .= $this->main->form->bottom("", $this->main->form->button("AddClient", "Add this Client", "onClick=\"passCPNewClientFormValues(this.form, document.step3);\""));

this.form is the form within the ajax-called script
document.step3 is the form within the script that made the ajax call

The code snippet is the function referenced above:

The function below is seeing the ajaxFormObject as empty, invalid or non-existent.

function passCPNewClientFormValues(ajaxFormObject,parentFormObject){
parentFormObject.cs_addr1.value = ajaxFormObject.cs_addr1.value;
parentFormObject.cs_addr2.value = ajaxFormObject.cs_addr2.value;
parentFormObject.cs_addr2.value = ajaxFormObject.cs_addr3.value;
parentFormObject.cs_city.value = ajaxFormObject.cs_city.value;
parentFormObject.cs_state.value = ajaxFormObject.cs_state.value;
parentFormObject.cs_zip.value = ajaxFormObject.cs_zip.value;
parentFormObject.cs_main_phone.value = ajaxFormObject.cs_main_phone.value;
parentFormObject.cc_direct_phone.value = ajaxFormObject.cc_direct_phone.value;
parentFormObject.cs_fax.value = ajaxFormObject.cs_fax.value;
parentFormObject.cc_mobile_phone.value = ajaxFormObject.cc_mobile_phone.value;
parentFormObject.cc_email.value = ajaxFormObject.cc_email.value;
}

Where am I going wrong here?

Thank in advance to those that can offer insight, as well as those that come up with the most creative insults.

dougal85
07-14-2008, 02:40 PM
There is no problem asking a non-PHP question.... but put it in the echo lounge or client side technologies (if its javascript etc.)

You might want to show us how you get the form object that is passed into the function...