Click to See Complete Forum and Search --> : where's my logic flawed?
rjusa
11-02-2003, 03:13 PM
if I have the following:
function updateParent() {
if($error$=="")
opener.document.parentForm.CndnSBFirstName.value = document.childForm1.cf1b.value;
self.close();
return false;
onClick="return updateParent()
what I'm tryin to say is that if $error$ contains nothing, then set the variables of parent/child equal and close the child window.
$error$ is the required field(s) message i.e., if I miss entering the data, it comes back with e.g., "Beneficiary required.' If I enter the value then $error$ displays nothing.
Thanks,
Ron
gil davis
11-02-2003, 04:53 PM
Using a $ as the first character as a javascript identifier is not legal.
If you post where that variable/object is defined, perhaps I can be more helpful.
rjusa
11-02-2003, 05:13 PM
Let me take a different approach. The $error$ reference is from a piece of 3rd part software I purchased and I haven't been able to talk to the developer this weekend.
What if I have input fields called cf1a, cf1b, etc. How could I tell the program that if these fields are filled in, then run the onClick script? This may be a little easier...I think.
Thanks,
Ron
gil davis
11-02-2003, 05:31 PM
I don't have the whole picture of what you are trying to do. You can't run an onclick from a function - you call a function from the onclick event.
Your post appears to have incomplete code. I am confused because it looks like you are trying to assign the onclick inside a function.
rjusa
11-02-2003, 05:48 PM
Sorry for the confusion Gil. I'm a novice at this and really appreciate your help. Here's what I've got. A main "parent" form that when you click "yes" opens a child window. You input the values and if you click "Update" the required fields checker is run...if you missed an entry it tells you, if all required are filled in, life is good. After you have run the required fields check, you click a second button "Continue" and the values are taken from the child, put into the parent and then the child window closes. I'd prefer if I could do this with one button. The 2 button code which works is as follows:
<script LANGUAGE="JavaScript"><!--
function updateParent() {
opener.document.parentForm.CndnSBFirstName.value = document.childForm1.cf1b.value;
opener.document.parentForm.CndnSBLastName.value = document.childForm1.cf1c.value;
opener.document.parentForm.CndnSBRel.value = document.childForm1.cf1d.value;
opener.document.parentForm.CndnSBpc.value = document.childForm1.cf1f.value;
opener.document.parentForm.CndnSBSS.value = document.childForm1.cf1e.value;
if (document.childForm1.cf1a[0].checked)
opener.document.parentForm.CndnSBIrr[0].checked=true;
if (document.childForm1.cf1a[1].checked)
opener.document.parentForm.CndnSBIrr[1].checked=true;
self.close();
return false;
}
//--></SCRIPT>
My two buttons are as follows:
<input TYPE="SUBMIT" VALUE="Update">
<input type="submit" value="Continue" onClick="return updateParent();">
Hope this clears things up a bit.
Thanks again,
Ron