Dynamic DataTable without validation of the rest of the form

I'm having a bit of trouble implementing a piece of functionality with JSF and I'm hoping someone here will have some insight into how to accomplish this.
I have a quite large form, with some fields requiring quite complex and expensive (both performance and actual money) validation (e.g. calling external web services, etc.). For the sake of the explanation, let's say the user enters details about himself, such as name, social security number, address, etc. Along with his details, he's to enter a limited subset of the details for each of his children (say name and social security number). We do not know at design time how many children the user has (obviously), so this part of the form has to be dynamically generated. Validation is performed on these children fields as well, so the user needs to be able to edit and remove children from the form.
Prior to JSF (straight JSP), I used DHTML and a naming scheme for these records with a custom setters in the backing beans.
What I have tried with JSF is to have a DataTable backed by a List. This table contains a single "Add Child" button which adds a new empty row to the table. There is also a "Remove" button for each row.
This works just great as long as I allow all other fields in the form to validate each time the user clicks the button. However, as I stated before, these validations are very very expensive (transaction based costs) . Additionally, I do not want to force the user to fill in all the other required fields (close to 40) before he can go on with the children.
Now, setting immediate="true" on the commandButton elements solves the problem of the other form fields validating. However, now the Children in the DataTable are never set because the update model values phase is never invoked, leaving me with empty input fields. I really do not care in this instance whether the data for the Children is valid or not, I just need to get them into the form.
I can think of at least three possible solutions:
1) Split up the form into several pages, like a wizard. However, the customer has rejected this option.
2) Somehow simplify the Children section by providing a single entry and a read-only table. This way I can use a simpler read-only table and I can extract the values from the request parameters directly. However, this complicated the editing of previously entered Children. To make things worse, the order of the children has to remain intact.
3) Create a custom HtmlInputText component that sets the values regardless of whether immediate="true" or "false".
It is this last option that I do not know how to do. Which methods would I need to override in order to get the values to be set in my bounded Children object regardless of the immediate flag?
And of course, if anybody has any other design suggestions I'm open to them!
Thanks in advance!
/Kris

nboudani , let me answer your question first. The page does have a Submit button. It also has "Add Child" and "Remove Child", and some others as well. The Submit button has immediate="false". I also need form validation for interdependent form fileds (e.g. either Passport number or social security number are required), so I'm using the "hidden input field at the bottom of the form trick". This all works well enough.
OK, I got partway there. jaguar2010's mention of valueChangeListener made me investigate that further. So what I did was twofold. Set the immediate attribute to true for the inputText elements in question (for the Children data) as well as for the commandButton (as before). Also, add a valueChangeListener for each of the Children which simply calls updateModel.
So, view code:
<h:inputText id="cName"
                       valueChangeListener="#{testBean.procCNameValueChanged}"
                       value="#{child.name}"
                       required="true"
                       immediate="true"/>
<h:inputText id="cSS"
                       valueChangeListener="#{testBean.processCSSValueChanged}"
                       value="#{child.ss}"
                       validator="#{testBean.validateCSS}"
                       immediate="true"/>
<h:commandButton action="#{testBean.addChild}" immediate="true" value="Add Child"/>
...bean code:
public void procCNameValueChanged(ValueChangeEvent event) {
    HtmlInputText sender = (HtmlInputText) event.getComponent();
    sender.updateModel(FacesContext.getCurrentInstance());
}So, that does take care of the problem with the model not updating. However, there are a bunch of other problems still left to be resolved. For instance, as you'll notice, there is a validator attached to one of the inputs. If this validation fails, the invalid text is not put back in the input field. I can't temember now, but I think that is because the valueChangeListener is not called in that case, so the model is not updated. Sigh...
Another problem is that for each row in the data model's table, there is a "Remove" button (not shown in above code) to enable the user to remove an entry from the list of children. Well, because JSF process events in the order of their appearance in the view code, an exeption is thrown if the removed row is not the last one, and the last row has not been "saved" yet. That is, the valueChangeListener has not been called on the last row. What happens is that first the action method for the remove button is called, then the valueChangeListener for the last row is called. But by the time the valueChangeListener event is fired, the last row has chaned its index (because the remove action method was called first) and apparently this fact has escaped JSF so it throws an exception (property not found or something).
I'm starting to wonder if JSF is the wrong technology for complex forms. Just seems to want to do too much for me, assuming I have a simple form.

Similar Messages

  • Change the background color of a particular word without changing the background color of the rest of the text in a textbox

    Hello,
    I'm designing my own website and want to know how to change the background color of a particular word without changing the background color of the rest of the text in a textbox. If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Thank you very much!
    Roger.

    If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Read this :
         Create and add a TABLE in iWeb »
         More about a TABLE in iWeb »
         Sample 1
         Sample 2

  • Is it possible to edit spoken dialog without interfering with the rest of the sound?

    I'm trying to piece together video clips from various movies, and in one of these clips the character swears strongly a couple times. Normally, I don't bother with this, but my audience is that of a "clean" nature and is strongly against profanity. Is there a way to briefly mute, or change the character's voice when he cusses and not interfere with the rest of the sound? Or is this asking too much?
    Also, I looked in the "help" section and couldn't find anything to help me with this. But I have a bunch more questions. Where do I go that will explain all the features of Premiere Elements 8, without forcing me to spend hours figuring it all out and/or posting a billion discussions here in the forums and bugging all of you with my lack of knowledge?

    What you are attempting to do requires a bit of work and then some luck.
    It sounds as though you have an Audio Clip with both background noise and possibly music, plus dialog. You wish to remove just the dialog in a particular spot, or spots. Is that correct?
    If so, then in an Audio editing program, like Adobe Audition, you can possibly extract the ambient sound/music with a Karaoke Effect, or with the application of EQ. This will yield a separate file with hopefully just the background and music, and no dialog. In a Multi-Track Session, place both files on a separate Track. Find the point where you wish to remove the dialog. Here, the workflow might differ, but I'd Cut out the dialog at that point, leaving only the Karaoke Track. To clean things up, when I had done this for each offensive passage, I would go to the Karaoke Track and do just the opposite - Cut out all that was NOT underlying the offensive passages, but leave a bit of that Track before and beyond the deleted dialog. Then, I'd add a Cross-Dissolve for Constant Power to those Karaoke segments to "ramp" the Karaoke Track into the mix, as it will never be perfect, and one wants as smooth a transition, as is possible.
    Now, one can do this in other audio editing programs, that offer Multi-Track editing, and also VST plug-ins, or install with Effects like Karaoke and/or Parametric or Graphic EQ's. You could explore the great, free audio-editor, Audacity, and Google for VST's that will enhance its capabilities. Be sure to read the Help files on Audacity, as one does need to do a few things in setup to allow the addition of more VST's.
    The work will be with the Karaoke (or similar) Effect, its result and also the frequency ranges of the speaker. That is where the "luck" comes in. Much human speech can be EQ'ed out, or at least greatly attenuated. Now, if you have a crowd talking in the background, or similar, and wish to retain that, all bets are off.
    Also, if you only have ambient sounds, and no music, behind the speaker, just find segments of that ambient sound, where the speaker is not talking, and use that to "patch" where you cut out the dialog.
    Good luck,
    Hunt

  • Is it possible to buy an iphone to use in the US and the rest of the world without buying a monthly phone plan?

    Is it possible to buy an iphone to use in the US and the rest of the world without buying a monthly plan? I'd like to travel without two camera, two cell phones and use my iphone as a backup camera and phone for texting and short calls during international travel. Can an iphone take sim cards as some smart phones?

    If you buy an unlocked phone from Apple you should be able to use it with any carrier. It'll be more expensive but you get the freedom to choose.

  • Hello, I'm a beginner and I want to know how to record let's say a vocal track, without recording the rest of the music on it ?

    I have imported several wav tracks into a project in Audition. Now, I'm trying to record a vocal track directly in the program, but it also records all the rest of the music on that vocal track... What am I doing wrong ?
    thanks,
    pierre

    See this ancient thread in the Audition FAQs.
    Track 1 records on Track 2 - how do I stop this happening?

  • How do I restrict access by domain and the rest of the world to the documents in the public_html folder in iPlanet Portal Server?

    Hello,
    We have multiple domains configured in our iPlanet Portal Server 3 demo environment. In addition we are using the gateway.
    In one of these domains the userTemplate.html file is tailored to display Macromedia Flash components at dynamic positions on the page. The logical home for these Flash components (since the portal software cannot find them if we simply store them in iwtDesktop) is somewhere below the /opt/SUNWips/public_html directory.
    The problem is that once the file is stored here I can access it if I know the url (http://server:8080/file_path) without being authenticated in the domain.
    The allow/deny url policy settings are specific to a domain and seem to have no affect on the rest of the world.
    Any advice you can provide is greatly appreciated.
    Thanks!

    Joel,
    If your intent is to block access to the doc root, you can probably use access control lists (acl) to prevent anyone from accessing the files stored under public_html. You can get more information about how to create ACLs from the following URL
    http://docs.iplanet.com/docs/manuals/enterprise/41/ag/esaccess.htm#1005439
    You can even set up Basic Authentication for access to the direcory or ip based access or any which way you want. I've personally never blocked access to the doc root in portal, so I am not sure what the impact will be.
    Hope this helps!

  • How can i keep my music from my iPhone and sync it my new macbook? Only purchased music seems to be available to sync, even though the rest of the music was uploaded from CD's on my  last laptop.

    Hi, I have changed from an old laptop to a macbook air. how can i keep my music from my iPhone and sync it my macbook? Only purchased music seems to be available to sync, even though the rest of the music was uploaded from CD's on my  last laptop.
    As I can't upload CD's onto the Macbook Air, how do I keep the existing music on my iphone syn onto my new macbook without deleting all the cds on the iphone??
    Many thanks!

    Hi RaulRod,
    Are you pressing the Sync button to transfer music after connecting your iPhone or do you have the option checked to 'Automatically Sync when the iPhone is connected?'
    Have you tried manually dragging and dropping music from your library into your phone?

  • Can I print a 2 page spread to .PDF from a CS 3 document where the rest of the pages are NOT spreads

    Since I do not know how to really describe this, please have a look and tell me how (if it's possible) if I can print (to PDF) this catalog where the pages (4) and (5) can remain as a spread and the rest of the document would print single pages.  I can print this as a booklet, but it's sideways online.  Our goal is to have our customers able to view the PDF online and get its full impact.  We really can't do that viewing it sideways OR by having the pages 4 and 5 split up like they are.
    http://provsnusa.com/pdf/Product%20Guide_GenRec_WEB_CURRENT_VERSION.pdf
    The problem we're having is we would like to NOT break-up pages 4 and 5.  We want this to look good for the users.
    Is it possible to have 1 spread only display all the way across - in other words, is there a way to NOT split up just pages 4 and 5 in this document?  The only way I know is to print ALL the spreads. 
    I tried: Creating the PDF with all the spreads, it does not look as good, but at least the 2 page spread is not broken up (4 and 5).
    But now if I go to print the PDF with ALL spreads, then it does not print properly on letter sized paper.  Are there settings I can embed where this will print properly where the end user does not have to make adjustments - i.e. We want the end user to be able to just hit "print" and it's done.
    I tried: I also created this InDesign CS3 document as a PDF booklet.  While this is OK, it appears sideways online to the viewer which is not desirable in this case.  Is there a way where the end user can view this correctly as a booklet online without printing?
    I guess as an alternative, I can upload the booklet for printing, and another version for viewing.
    Maybe there's a special web based PDF viewer out there or something - I'm very ignorant here.
    Any suggestions would be very helpful
    Sorry for the long wind - hope I've made sense.
    Dan

    Why not reconstruct the pages in InDesign they way you want the double pages to appear. There may even be an imposition script available that will do the trick. You could then output to pdf all the pages you want the full spread on. Leave the original to create the pages you wanted left as is.
    You can ask in the ID forum about an imposition script. I know there was one with CS4, there may have been one with CS3.

  • When I Apply Redaction to the selected area the area is redacted, however the rest of the doc becomes unreadable. Is there a fix for this?

    FYI - I am using Acrobat X Pro v 10.1.13
    If I convert a MS Word Document to a PDF file the Redaction works fine without affecting the rest of the document.
    The problem I am describing below only seems to happen on documents that have been scanned to PDF from my Lanier Copier/Printer/Scanner/Fax machine MP C3502.  I purchased the Adobe PDF software for the machine so that I could scan from the machine directly to my computers. The scan arrives onto both of my computers, no problem. I can open them and print them with no problems. Both Computers have Acrobat Pro X software on them.
    Here is what I do:
    1. I receive an Invoice in the mail
    2. I scan it at 600dpi from my Lanier machine to my computers
    3. I open the scanned PDF doc on my computer
    4.I select Save As and give the doc a name
    5. I open the Tools and go to Protection
    6. I select Mark for Redaction
    7. I select the area I want Redacted
    8. I Apply Redaction
    9. I answer, Yes to the pop up window asking me if I want to Apply the Redaction
    10. Another pop up window confirms the Redaction is successful
    11. At this point I can see that the Redaction had occurred however the rest of the document appears washed out and I cannot read any other information on the document.  Thing such as bar codes or header in color all seem to be fine but all the type is washed out and unreadable.  I normally use Black for my redaction color however I have tried using other colors and I get the same effect.
    When I first installed the Acrobat Pro X software a few years ago I never had any problems,  I recently began updating the Acrobat software a few months ago and now I have this problem,
    I would appreciate any help.
    Thank you,
    BG10

    Thank you. I figured it out right before I heard from you.  Running the OCR before the redaction made it work correctly.
    Thank you so much for taking the time to answer my question.
    Make it a great day.
    BG10

  • Choosing LOV in the table row , clears the rest of the columns

    Hi. I am on Jdev 11g R3
    I have a table with several editable columns. One of the columns is LOV
    I put some data in the NON lov field.
    Next I choose the value from LOV. As soon as I choose the value in LOV  - the rest of the fields get cleared and appears empty.
    I can solve it by setting "autosubmit=true" on each column, but I wander if there is an option to preserve column values without "autosubmit"
    Please advice

    Which version is 11g R3?
    I only know abpout 11g R1 (11.1.1.0.0 - 11.1.1.7.0) and 11g R2 (11.1.2.0.0 - 11.1.2.4.0).
    Where does the LOV store it's selected value?
    Does this happen if you set the LOV to autoSubmit="true"?
    Timo

  • HT1751 Question: Is it possible to move just part of my iTunes content (i.e. TV shows) to an external harddrive, keeping the rest of the content in place?  Several seasons of TV shows are taking up 102 GB of space, and I'm completely out of space on my HD

    Is it possible to move just part of my iTunes content (i.e., only TV shows), keeping the rest of the Library in place?  I have purchased several seasons of some TV shows, which take up 102 GB on my harddrive, inside my iTunes Media Folder.  I don't want to move my entire Library of music and apps etc to the external harddrive (HD), but I rarely watch the TV shows, so wouldn't mind them being located on an external HD, which I would plug in before trying to watch the shows through iTunes?
    Any advice?
    Thanks! 

    I don't think you can simultaneously have two libraries open. But you can have your media spread across multiple disk drives. Just change your iTunes preferences such that the option "Copy files to iTunes Music folder when adding to library" is not selected. That way, new items can remain on your external drive if that's where you add them from.
    The only caution is if you ever add items to your library from some "temporary" location, such as a USB drive. With these preference changes, iTunes would keep the native file on the USB drive, which would possibly lead to you deleting the file and losing the link. So, when you have your preferences to allow you to add new items to iTunes without copying them to the iTunes Music folder, you would want to put the native files in the desired location first, then add to iTunes.
    To move existing videos and podcasts to the external drive, you can either do that as you have been (moving the native files and correcting the ! warning), or simply delete them from the library (but keep the native files) then re-add them from their new location on the external drive (you'd lose play history and ratings though, but may not be an issue for videos and podcasts).

  • My itunes is separating the first song from the rest of the album

    Can anyone help, my itunes separates the first song from the rest of the album so they apear as two separate things in itunes, very very annoying as it has only done it one some albums not all!!

    I was having this problem if I changed the name of an artist for an entire album from in grid view. This ended up changing the name successfully, but left me with the first track as a separate item in the grid. The solution suggested by bkpr worked for me; I entered the artist name into the album artist field, and saving this change merged the album back together. I could then remove the album artist entry without the album separating again. Thanks for the suggestio bkpr

  • When using the OS X caching server, after the first update is made, do the rest of the computers have to enter the Apple ID to download the cached update

    Hello,
    I have a question that I had not found an answer to yet. I would like to use the OS X caching server, and I know that it caches a software update as soon as the first computer downloads it. If an application requires authentication using an Apple ID, and the first computer authenticates and downloads that update, do the rest of the computers have to authenticate as well, even though the update is downloaded from the caching server?
    I am looking for a solution in that regard. For the company that I work, I would like a solution for users to be able to download software updates (OS or Application), without having to authenticate with the company Apple ID, for security reasons.
    Would anybody be able to help?

    Yes.  You still need to authenticate on the subsequent machines if you are interactively applying the updates.  Caching server stores the application data, not the App Store authorization information.
    You have some alternatives.
    1:  If you are using a single "corporate" Apple ID to claim your free apps (iMovie, iPhoto, etc), then you can download them on your master machine and then user ARD, JAMF, or other tool to push the full application packages out to all the clients.  They will already be tagged to the Apple ID and since the push is happening in the background, as long as the user is not using the application, they will not know you are updating.  Remember, App Store updates are the entire application, not update packages.  So pushing the entire .app bundle is effective.
    2:  If you are looking to distribute purchased apps, you really should look at the VPP (volume purchase plan) from Apple (http://www.apple.com/business/vpp/) (there is also one for education but you mentioned company).  This allows you as the organization to purchase the correct number of copies and then control the distribution of the apps to your end users.  They can use their own Apple ID to claim the apps but you can reclaim the license should the user leave the organization.
    Reid
    Apple Consultants Network
    Apple Professional Services
    Author "Mavericks Server – Foundation Services" :: Exclusively available in Apple's iBooks Store

  • Videos loading BEFORE the rest of the page!

    I just published my site with the new iWeb 08. The pages are loading very slowly for people because it's loading my video clips FIRST, then the rest of the page. Is there anyway to have the page load first, and THEN the video clip? Is there a setting or something that I'm missing?
    Thanks for any responses!

    Here's a trick that worked with my Podcast page and entries.
    I noticed that if you create a new text box on the page it will load before the media files. So if you click on the text box that you want to load before a media file and Duplicate it (Cmd+D) it will lay right over the top of it without anybody realizing it. And it will load first. Of course, the font suffers a little, but it accomplishes the desired effect. In case the duplicated text box isn't aligned sufficiently after the page loads, give the overlaying text box a background color that is the same as the page. That way the latent text box doesn’t even need to be visible after the page fully loads.
    This takes a bit of fudging around and re-publishing, (checking it on different browsers is highly recommended), but until Apple fixes the bug it seems like the easiest way to keep people entertained with reading while they wait for the media file to load.

  • How can I make my question slide look and act like the rest of the project?

    Hi,
    I have created my project without using a template. Each time I needed to create a new screen I simply duplicated the slide and then inserted new text. This worked quite well. However, when I tried to do this for a question slide, it wouldn't let me (obviously).
    Is there a way of customising a question slide to look exactly like the rest of my project (and have the interactivity on the slide that the rest of the project has)? When I tried designing a new template and question template side and applying it to the question slide in my project, I could only insert a static image as the background on the template slide. Needless to say, there was no interactivity on the slide, i.e. no active click boxes etc, and I couldn't add these either when I applied it to the slide.
    Any help is much appreciated. This is for a Masters project, so I'm still learning the basics.
    Thanks.

    Hi Lilybiri,
    I am using Captivate 4. All of my screens so far look like a website - with menus and makeshift spry menus (image maps with click boxes). My preference is to use this layout for the question slides. However, it sounds like this isn't possible. What do other people do to make their question slides look a part of the course?
    Thanks.

Maybe you are looking for

  • Any ideas? cant get purchased tracks back to iPod

    Hi, A friend of mine uses iTunes and purchases music via the iTunes Music store. Recently the hard drive died but he had a backup of his Mac so everything was restored including the music. He can see the music in iTunes he had paid for via the iTunes

  • Flash card gives this: The disk you inserted was not readable by this compu

    I bought a new Kingston 2gig SD flash card and I get this error when I try to read it using my MBP using my flash card reader: The disk you inserted was not readable by this computer. Do I have to change some settings? Help!

  • R3 Client Change in BW

    Source System Client for R3 needs to be changed (from Clent X to Y)  in BW. We are planning to use BDLS for that. We are concerned about the datasources that were activated in Client X (in RSA 5). when we do a client change does it automatically refl

  • How do I make a rule to automate replies while I'm on vacation

    I'm using A power book G4, OSX 3.9, and mail 1.3.11 The mail help says, go to mail>preferences and click on "rule". When I go there i find no "rule" button or icon, only account information. Can this be done? Does anyone know how? HELP!!

  • Can't copy and paste codes since upgrade

    When I upgraded my itunes I haven't been able to copy and paste codes every since, I have to type each letter/number in. I'm losing free codes. Anyone have a fix? thanks