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
Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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.

789 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