Announcement

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

    required=true dynamically set

    <smartgwtVersion>3.1-p20140602</smartgwtVersion>
    FF 24


    Hi,

    is it possible to set the required="true" dyniamically on the client and server side?

    For example I have two fields in my *.ds.xml:

    <field name="A" type="text" />

    <field name="B" type="text" length="50" required="???"/>

    If the field "A" has a value then field "B" shoud be requred=true on the client and server otherwise required=false?

    I looked for some examples with requiredIfvalidator but there the functionality seems to focus only the client side.

    Thanks for any help in advance,
    zapryano

    #2
    Hi zapryano,

    interesting question. From reading ValidatorType.REQUIREDIF I'd also say that this is client-only. As ValidatorType is linked from docs/serverds/Validator, one might think otherwise.

    @Isomorphic: Is zapryano's assumption correct and are there other client-only validators?

    @zapryano: You should be able to solve your use case with a SERVERCUSTOM validator and a velocity expression or, if you like Java better, an serverObject.

    Best regards,
    Blama

    Comment


      #3
      This should indeed be implemented as a serverCustom validator.

      If, for performance reasons, you also want client-side enforcement that prevents invalid values from ever going to the server, add a Custom Validator as well in client-side Java code.

      Comment

      Working...
      X