Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Server validation for groups

    SmartGWT version: SmartClient Version: v9.1p_2014-03-04/PowerEdition Deployment (built 2014-03-04)
    Browser: FireFox ESR 24.3.0, with FireBug installed

    I am having trouble doing server validations on a form section that depends on some values in another form section. The scenario is the following:

    1) I have a layout with two groups, so I have two dynamic forms each with IsGroup set to true. The form values are all managed by a valuesManager
    2) The datasource for the valuesManager contains all the fields and some of them use server validators:
    Code:
     
    <field name="abc" title="Field1" type="integer" >
    <validators>
    <validator type="serverCustom">
       <serverObject lookupStyle="spring" bean="abcBean" 
    methodName="bean Method"/><errorMessage>Some error</errorMessage></validator>
    </validators>
    </field>
    3) When calling save, it triggers server side validator's condition method
    Code:
    public boolean condition(final Object value, final Validator validator, final String fieldName, final Map record, final DataSource ds, final RPCManager rpc) {...}
    The server validator has the values for the current section only, and I couldn't find a way to include or get the values from some other section. Could you please help provide some hints? Thanks.

    #2
    Hi ecoli,

    I don't know if this is a bug, but if not, how about HiddenItems in the dependent DynamicForm that you set onChange of the parent form?

    Do you get two separate validate requests and also two separate add/update requests?

    Best regards,
    Blama

    Comment


      #3
      Could you show us the definition of the ValuesManager, the DynamicForms it contains, the DataSource, and what your logic to kick off the save looks like?

      Also, can you clarify - when you say "The server validator has the values for the current section only", do you mean the record argument passed to the validator is missing values for fields included in the ValuesManager, but actually present in a different DynamicForm?

      This will likely give us enough to determine what's going on

      Regards
      Isomorphic Software

      Comment


        #4
        Hi Blama,

        Thanks, I had the same idea but then as the page I am building contains a lot of fields and the validation needs to check a number of them, I found I am creating a bit too many of the hidden items. The field is validated on editor exit once and then again on save.

        Hi Isomorphic,

        I am including a sample flow as I am not allowed to pasted detailed code. The problem is that when I end edit for field 1, a server validation takes place. And as you mentioned, the record argument for the validator only contains the values from Form 1, nothing from Form 2. However, if I click save button that triggers valuesManager.save(), the same record argument in the same validator contains values from both forms. Is this intended behavior? Thanks.
        Attached Files

        Comment


          #5
          Hi Isomorphic,

          Any replies, thanks

          Comment

          Working...
          X