I currently have the following:
-
While viewing a table with pets and owners I have an edit link. When clicked I have an edit form popup where the values are returned via ajax.
-
The fields are id,petname,species,dogpic,ownerid,petowner,oaddress
-
On this popup form where the ownerid input tag is I have a button that I click which opens another popup window to search for the owner. In other words lookup the correct owner or find owner if none is entered. This popup starts with a search field, where you can enter the first few letters of owners name, and hit OK and a paged table comes up with owners whose name start with the before said search expression. This table is also returned via ajax.
-
Each table row has an id. And the tr tag has an onclick=“cell(this.id)”
-
I currently return the ownerid,petowner,oaddress to the first mentioned edit form like this: code follows
function cell(id)
{
var x=document.getElementById('myTable').rows[id].cells;
opener.document.editform.ownerid.value = x[0].innerHTML;
opener.document.editform.petowner.value = x[1].innerHTML;
opener.document.editform.ostreet.value = x[2].innerHTML;
// or opener.document.editform.ostreet.value = x[2].FirstChild.NodeValue;
// FirstChild.NodeValue works as well...
self.close();
}
</script>
Which IS NOT ajax returned.
This is where I need help. How to return the ownerid,petowner,oaddress data from the table in step 3 back to the original popup edit form with ajax. Is this possible in ajax, or would this be an ajax in an ajax? Id like to retain the on row click event in any case because it’s user friendly.
Likewise, is there anything wrong with returning the data as I am currently doing? Either way, Id still like to know how to return it via ajax. It’s very tricky since the first popup form is already displayed via ajax.