0 Replies Latest reply on Jul 24, 2008 10:54 AM by Indrek Altpere

    How to skip validation for some ajax requests ?

    Indrek Altpere Newbie

      What I have is like this:
      a table with lots of rows in it, that have description and input fields, dropdown lists and checboxes.
      What is needed is that when a user checks/unchecks a checkbox, some rows need to be shown or hidden, and since richfaces does not support doing updates for html elements that are not some tag library components, only solution was to make <a4j:support /> tag rerender the whole a4j:form thus showing/hiding needed rows.
      Richfaces (latest) is being used together with latest Seam.

      The problem begins from the fact that there are some fields that have required="true" and requiredMessage="message" assigned to them.

      When at first I added a4j:support to checkboxes and dropdown lists, after update that caused the submit to server, error/validation messages were shown for fields (displayed by h:messages tag).
      What I first did was to add ajaxSingle="true" for those inputs that needed to trigger whole form update, so they did not trigger the requiredmessages to be shown.

      What I first missed with that approach, was that if I trigger a ajax update with ajaxsingle, all fields that have not been sent to server, revert to previous values, because ajaxsingle submit sends only one field value to server and when whole form html is sent back, the other fields that were changed on client side before ajax submit, revert back to their vauels on server.

      As I see it there are 3 possible solutions:
      1) somehow make it possible to turn off validation phase with some a4j:support tag attribute (combination) but so that entire form fields are still sent
      2) somehow make richfaces update the table rows (is there such way ?)
      if rows could be updated it would be peachy since it would be possible to output blank rows with style="display:none" and then later update the style and contents (such thing was possible with icefaces but we moved to richfaces for better performance)
      3) if currently a4j:support does not enable such behaviour, make a feature request for it

      Currently I have no idea for any workarounds, since to me it seems point 1 is not possible and neither is point 2, and point 3 will take long time.

      Any ideas, suggestions, workarounds, hacks anyone ?
      I'm currently out of ideas :(