Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-04-14
1
Medium Priority
?
1,643 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
knrrjohle earned 1500 total points
ID: 24212985
0

Featured Post

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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…
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.
Suggested Courses

715 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