Menu

Some little fix on validation?

Help
2004-11-15
2013-06-03
  • Luigi Piatti

    Luigi Piatti - 2004-11-15

    This is for break my old post on validation that became too long.

    1) I changed my dbforms_generate_validation.xsl to address some bug found.
    here is the list of canges:
    a)Added a new template named dependsAttribute: useful to automatically append required validation on fields.
    Automatic Detection of "Required validation" is based on a non-standard non-mandatory field named "required" to add as attribute of required fields in dbforms-config.xml file.
    If this attribute is not specified or is not equal to 'true' transfomation behaviour is as before.
    b) added test of required attribute on foreignkey required validation as above. Imho relationships can be not mandatory. Default behaviour as before.
    c) replaced maxchars variable definition with maxlength in "maxlength validation" maybe a bug
    d) removed all variable substitution from msg tag, this is never replaced at runtime
    e) rewritten error messages to address default dbform format = msg:arg0,..,arg4

    2) In my debug sessions I found that standard required validation as a little bug.
    In case of adding a new record, value!=oldValue is a condition to verify to apply required validation, but this in never true while adding new records
    Henner say: There is a parameter somewhere with wich you can distinguish between insert and update mode.
    I have modified the code a little without searching for this parameter, I think that removing incorrect test is more efficient that adding a new test and branch

    How can I send this files?

    3) when I try to start float validation on server side I get this error:

    ERROR org.apache.commons.validator.Validator  - reflection:org.dbforms.validation.DbFormsValidator.validateFloat(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field)
    I searched source file and in DbFormsValidator Class this method as a different signature: Locale as one more parameter ..
    Is this a bug or I missed something?

    A little trace:

    java.lang.NoSuchMethodException: org.dbforms.validation.DbFormsValidator.validateFloat(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field)
        at java.lang.Class.getMethod(Unknown Source)
        at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:401)
        at org.apache.commons.validator.Validator.validateField(Validator.java:544)
        at org.apache.commons.validator.Validator.validate(Validator.java:582)
        at org.dbforms.event.ValidationEvent.doValidation(ValidationEvent.java:109)
        at org.dbforms.servlets.Controller.process(Controller.java:305)
        at org.dbforms.servlets.Controller.doPost(Controller.java:107)
    ....

    bye
    Luigi

     
    • Henner Kollmann

      Henner Kollmann - 2004-11-15

      Hio Luigi,

      Could you repost your mail to the mailing list? This forum is'nt read by a lot of people. Discussen of dbforms happens in the mailing list.

      You can send me your changes via mail. I can have a look at them and commit them into the cvs.

      2) Removing the condition is'nt a good idea - you will break existing code which will allow empty fields - if they are not changed.
      Send me your changes - then i can see what i can do.

      3) Seems to be a bug.  Must be corrected in the validator.xml or in the class - i will check this.
      The method signature should be the same for each validation function.
      So there are 2 possibilities: The correct method is missing or the validator file is wrong.

      bye,
      Henner

       
      • Luigi Piatti

        Luigi Piatti - 2004-11-15

        ok, if there is more audience i will beautify my english before post.

        1) i send it as attach to your address? What address can I use?

        2) i'll send code ..  imho if we speak about "required validation" the code must not permit "empty field"  so probably no code break will appear

        3) ok, problem is on validator-rules
        For float attribute methodParams is missing.
        I tried to add it on the fly and all goes well

        Tank you
        Luigi

         
        • Henner Kollmann

          Henner Kollmann - 2004-11-15

          I think your english is good enough! Mine is'nt better :-).

          > i'll send code ..  imho if we speak about "required
          > validation" the code must not permit "empty field" 
          > so probably no code break will appear
          But fields that are not changed should'nt be tested...
          2 minds...  Let me see your code.

          Send me your patches to Henner.Kollmann@gmx.de!

          Thanks,
          Henner

           
    • Henner Kollmann

      Henner Kollmann - 2004-11-16

      Hi Luigi,

      i changed the validator code in the CVS. Could you get CVS version?
      If you can't use CVS send me a mail. I will generate a new version then.

      Henner

       
      • Luigi Piatti

        Luigi Piatti - 2004-11-16

        hi,
        i'm not using CVS but having a new snap it's not so urgent.

        I'll wait a bigger release :-)

        ... and i'll try to use CVS to experiment it

        Tank you
        Luigi

         

Log in to post a comment.

MongoDB Logo MongoDB