Having trouble sending a form to a window.

I'm a bit stymied on what I'm doing wrong. I have the following apparently straightforward HTML code:
<form name="editForm" method="post" action="updPurchDataEdit.jsp" target="PurchEdit">
<input type="hidden" name="purchaseId" value="168">
</form>

<div style="position: absolute; top: 110px; left: 60px; font-size: smaller; font-weight: bold"
  onmouseover="document.body.style.cursor='pointer';"
  onmouseout="document.body.style.cursor='auto';"
  onclick="location='updPurchDataEdit.jsp?purchaseId=168'"

<!--  onclick="var w = window.open('','PurchEdit','width=900,height=540,top=50');
    w.focus();
    document.editForm.submit();"-->

<img alt="" style="vertical-align: bottom" src="images/Write1a.gif"/> Edit Purchase
</div>

Open in new window

When I run this as shown, it works fine. When I run the commented code ("var w = ...) instead of the "location= ..." code, I get a blank page, no form inside. I've done this dozens of times and in fact have another such window.open in the same program that works fine. Can anyone see what might be wrong here? This used to work.
LVL 1
jmarkfoleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
It works for me - of course you are removing the other
onclick="location='updPurchDataEdit.jsp?purchaseId=168'"

Open in new window

Before you uncommet the commented section ....?
0
jmarkfoleyAuthor Commented:
I was able to figure this problem out with the help of the HTML validation tool at https://validator.w3.org/ and using the Linux Kate editor which highlights html tags and matches DIVs. My html is fairly large, conditionally constructed via jsp. It turned out that I had a number of misplaced </div> and </form> statements which https://validator.w3.org/ easily flagged and the Kate editor allowed me to collapse and expand blocks to see what end tags matched with what. After fixing up the HTML (no errors found by https://validator.w3.org/) the open.window() code shown in my O.P. started working just fine.

Even though I had not other comments on this I'm going to leave it stand and not delete the question since others might find these tools useful for similar purposes.

Oh! It looks like Julian Hansen submitted a comment at the same time as me!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmarkfoleyAuthor Commented:
Julian, you win the points just because!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

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.