keronstamp.blogg.se

Validation icefaces
Validation icefaces




  1. VALIDATION ICEFACES UPDATE
  2. VALIDATION ICEFACES CODE

This will trick ICEFaces into thinking the commandButton has changed, causing it to refresh it and setting the disabled value to false, effectively re-enabling our commandButton. This ensures we will get a different value for the styleClass property on each form submit. Then in my backing bean I implemented the getter for this value as follows: I choose to "abuse" the styleClass property for this use. This means we will have to trick ICEFaces into thinking a property of our commandButton has actually changed, causing it to refresh the commandButton. It also means that our commandButton will not be updated, since for ICEFaces nothing changed to this component (it isn't aware of the JavaScript function we performed on it). This is a smart technique, since it reduces http traffic.

VALIDATION ICEFACES UPDATE

What this means is it checks if any of the components properties were changed in the action and it will only update those components whose properties have actually changed. Unfortunately ICEFaces is smarter than that, and uses a technique called "partial dom updates". I thought that ICEFaces would re-evaluate the form after the submit, causing it to reset the disabled property to false. My first try was to add the disabled property with a value of "false": Re-enabling the commandButton when the action finishes is not as easy as it may seem: there's no "onAfterSubmit" action or something similar on the form. The problem is that your commandButton is now disabled, so the user can't try again. In most applications this unfortunately won't be the case: if something goes wrong with the file upload or if some other form components fail validation, you will want to stay on the same page, giving the user a warning message and allowing him to try again. This works fine, and if you always go to a new page after the form has been submitted this is all you have to do.

VALIDATION ICEFACES CODE

All you need to do is add this code to the commandButton tag:

validation icefaces

There is a very easy approach to this: just disable the submit button once it has been pressed.

validation icefaces

This is obviously something you want to prevent. Uploading a file takes a while, and I quickly noticed the user could click the "upload" button multiple times while the upload was in progress. The old inputFile component has been removed from ICEFaces 2. ICEFaces 2 has a new component for files, called the fileEntry (see ). I created a form in ICEFaces 2 to upload a file.






Validation icefaces