Javascript: Change form action of form on Opener

I'm terrible with Javascript, mainly because of the case-sensitivity, however, I'm now doing something that I have only done once or twice, but I can't remember exactly what syntax I used, so I'm not sure if I'm missing something or if I have a case-sensitive issue.

Here's what I have:


      <script language="javascript">
                  
            if EVAL(window.opener.document.frmAdd)
                     {
                  window.opener.frmAdd.action = "AddInstallation.asp?ptype=postback";
                  window.opener.frmAdd.Submit();
                   }
            else {
                  window.opener.frmEdit.action = "EditInstallation.asp?ptype=postback";
                  window.opener.frmEdit.Submit();                        
                          }
      </script>

What I'm trying to do is determine if a specific form exists on the opener (form that opened the popup) and if it exists, then change the action property of it, and submit the form.

Anyone see what I'm missing.

Thanks
-Anthony
LVL 10
ALaRivaAsked:
Who is Participating?
 
ZylochCommented:
Hi ALaRiva,

f=window.opener.document;
if (f.forms["frmAdd"]) {
   f.forms["frmAdd"].action="AddInstallation.asp?ptype=postback";
   f.forms["frmAdd"].submit();
} else {
   f.forms["frmEdit"].action="EditInstallation.asp?ptype=postback";
   f.forms["frmEdit"].submit();
}


Regards,
Zyloch
0
 
ALaRivaAuthor Commented:
Perfect Zyloch!   Thank You.

BTW - I posted a solution to that Flash File and DHTML Menu question you were involved in.  Just in case you don't come across it.

-Anthony
0
 
ZylochCommented:
Yeah I saw. What was that wmode thing anyways? I think that's a great solution that you got there :)
0
 
ALaRivaAuthor Commented:
It's the window mode of the flash file.  If you set it to Opaque it allows other objects (i.e. DHTML Menus) to be displayed above it.  Sort of getting around the Z-Index issue you mentioned.

There is also a way of saving the Flash File with an Opaque setting already defined, but I don't have Flash in front of me so I couldn't give direction on which menus to look at.

-Anthony
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.