Solved

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

Posted on 2009-04-14
1
1,565 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 215
word0 challenge 4 68
sites similar to codingbat to improve coding hanson skills 3 49
eclipse apache tomcat admin console 52 95
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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.

785 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