Solved

JSF-Prompt for user input in a popup, display entry in textarea.

Posted on 2009-04-14
1
1,553 Views
Last Modified: 2013-11-24
I have a JSF form that contains among other things, an <h: inputTextarea>.  

That text area contains a running history of comments.  Basically, this form can be viewed and edited any number of times, and the purpose of the comments section is to keep a log of changes.

My goal is to make that textarea disabled when the form is displayed, but pop a dialog up when the form is saved in which the user can enter their comments.  Then, using basic DOM stuff, updating the textarea when the user hits OK on the dialog. This forces the user to enter a comment before the form is submitted.  

How can I create a pop-up window, or prompt with a textarea, in which the user can enter their comments and then, after clicking OK and closing the popup, have the form go on with it's normal behavior?  Or if CANCEL is clicked, have the user returned to the form.

Normal textarea validation won't work, since there may already text in that field.  The user is simply adding on to it each time he submits/saves the form.

I've done similar things with javascript in non JSF projects, but the problem I'm running into with JSF is that even if I pop up a javascript window using onclick="someFunctionToCollectComments()" the javascript window pops up, but it doesn't prevent the default behavior of the commandButton from kicking in.

Ex: <h:commandButton value="Save" onclick="getComment();" action="#{OrderBean.save}" disabled="#{!OrderBean.editable}" rendered="#{OrderBean.approverType}"/>

I get the window created by getComment, but in just a couple seconds, action OrderBean.save kicks in and wipes it all out.

Any ideas would be greatly appreciated.
0
Comment
Question by:krussell222
1 Comment
 
LVL 2

Accepted Solution

by:
knrrjohle earned 500 total points
ID: 24212985
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now