I have the following form fields: 1. name of contract 2. description 3. date start 4. date end 5. approvers*
the approvers is a list of users that must approve the contract. My question is how should I design such a form, so when the end-user clicks the approver's button, a new window will pop up with the *list* of users and he can simply check the user that should approve the contract. once the end-user is done, he can close the window (button to commit) and return to the form for submit.
Open the window using the window.open(...) function. The URI you specify can refer to a JSP that will create the list of approvers with checkboxes
When the parent window is submitted, the created hidden fields will be submitted along with it. Make sure you have properties in your ActionForm to handle the approvers
here's another possibility: what if I can open a new window with a list of all users, and the end-user can choose from the list the approvers. when he clicks OK I can place all the list he requested on the HttpSession and than retrieve it after the end-user clicked submit on the main form?
the only problem I'm not sure of is what happens when the user clicks OK on the approver's list - how to close the window from the Action?
thank you Merrill
Joined: Feb 15, 2005
If you're going to submit a form from the popup window, here's what I'd recommend: Create a small HTML file named closeWindow.htm that contains the following:
*Note onnload should be onload
Then have your Action class forward to "closeWindow.htm" to close the window after it has put the data in the session. The reason I recommend doing it this way is that when I've tried to close the window in the JSP that contains the form, I've run into strange problems with the fact that sometimes the window closes before the form gets properly submitted and the data is lost.
In answer to your question about reference material, I've found that one of the best sites is Microsoft Development Network (MSDN). Obviously it assumes you're using Microsoft Internet Explorer, so you have to be careful to cross-reference it with other sources to make sure what it tells you is valid for other browsers. Here is the link: