Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Submitting a popup and displaying the error messages on the popup itself

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Please help me. It is very urgent. Here is my problem.

I have a jsp with multiple forms. I am placing one form in the div tag and hiding that. After certain period of time I have to show the hidden form as a popup for authentication(for security)asking the username and password. If we submit that popup form, it should be submitted and the corresponding response should be shown in the same popup.

But whats happening in my case is, i am able to see the popup after some time but when I click the SignIn button on the popup, the whole form (not the popup) is getting submitted and the main form is replaced by the result page.

How should I submit the popup form only. And one more thing is how can I lock the main form while the popup is open so that the user is not allowed to continue his transaction until he is authenticated once again.

Please help me.Very urgent....


Thanks,
Srinivas.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, please read this link and attempt to understand why it's never a good idea to put "very urgent" in a JavaRanch post.

Now, for your question: What you have created is not a "popup window". It's a trick I've played before with displaying and non-displaying parts of the page. Sometimes it's a good solution, but sometimes it isn't. In this case, where you want to submit a form from "the window" and have the form return to the window, I'd suggest you use a real popup window using the window.open() function. If you do this, any form submitted will return to the same window.

There is another problem with this approach, though: Since you're apparently opening the window as a result of a certain amount of time elapsing rather than by a direct action of the user, this popup window is likely to get blocked by the popup blocking software that many users have now.

If you want a "modal" dialaog box, meaning one that causes the original window to freeze and not be available until the dialog box is answered and closed, Microsoft Internet Explorer has a function called showModalDialog that creates this type of window. (See this link for information on this function in other browsers). It has a drawback as well, though: You can't submit a form from it and have it return to the same window. If you use this type of window, your best option is to use AJAX to communicate with the server and verify the user's credentials. If the user authenticates, simply close the dialog window and let the user continue with the applications.

For more information on showModalDialog, see this link.

One more thing: This post has nothing at all to do with Struts. For this reason, I'm moving it out of the Struts forum and into the Html Javascript forum.
[ February 24, 2007: Message edited by: Merrill Higginson ]
    Bookmark Topic Watch Topic
  • New Topic