Announcement

Collapse
No announcement yet.

How to disable back end field validation to avoid the "Field Validation" error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • item
    replied
    Hi Telecastg,

    found-it
    As reminder is a entity.. so this work in entityDefs meeting.json
    I have leave out-of-box validatorMaxCount, i will copy-past the other valid in custom folder.

    PHP Code:
    {
        
    "fields": {
            
    "reminders": {
                
    "validatorClassNameList": [
                    
    "Espo\\Modules\\Crm\\Classes\\FieldValidators\\Event\\Reminders\\MaxCount"
                
    ]
            },
    ​ 
    And in entityDefs reminder.jon :

    PHP Code:
    {
        
    "fields": {
            
    "type": {
                
    "options": [
                    
    "__APPEND__",
                    
    "Sms"
                
    ]
            }
        }
    }
    ​ 
    Regards

    Leave a comment:


  • telecastg
    commented on 's reply
    Hello @item

    Easiest solution is to write this:

    {
    "fields": {
    "type": {
    "type": "enum",
    "options": [
    "__APPEND__",
    "Sms"
    ],
    "validationList": [],
    "mandatoryValidationList": []
    }
    }
    }

    The above will tell the system to ignore the hard coded validation rules.

  • item
    replied
    Hi telecastg

    i have a question for you :
    i have create a custom entityDefs reminder.json
    PHP Code:
    {
        
    "fields": {
            
    "type": {
              
    "type""enum",
                
    "options": [
                    
    "__APPEND__",
                    
    "Sms"
                
    ]
            }
        }
    }
    ​ 
    I see Sms in reminder->type... but validation issue.
    Error 400: Bad request
    Backend validation failure.

    Field: reminders
    Validation: valid


    I have seach but it's hard code TYPE_EMAIL, TYPE_EMAIL on field Validator.
    Where do i have put for disable validator and create my own field validator who are just a copy past out-of-box validator and add 'Sms'

    Thanks

    Leave a comment:


  • abisbe
    replied
    I had the same issue Upgrading to 7.3.4, this solved my issue, as we probably had some misadjustment from the people that developed the site we use for the payments, but the update really meant that for 3 days until we noticed, no payments were being registered into the system, because the policy of field validation changed.

    I had the same issue too when copying the solution, it added an extra character, but thanks to that you posted the solution here it was solved quickly too.

    Thank you all!

    Leave a comment:


  • shalmaxb
    replied
    item and telecastg

    Great! That did it. The shown characters, which are not visible in the editor I use (Notepad++) is the so called "zero width space" (I think the 0x200b ist the HEX code for that character). In another discussion I found the reason: This character is inserted by Google Chrome (don`t know if in other browsers too) and you see them as soon as you open the browser tools pointing to the code inserted in the first thread, see photo.
    As soon as I typed the code instead of copying, it worked.
    Thank you for your efforts and hints!

    Leave a comment:


  • item
    replied
    i have just copy past .. in "sublime text" editor :
    i don't know what's is "​​​<0x200b>" .. it's maybe invaders ..

    Leave a comment:


  • telecastg
    commented on 's reply
    I I see the same red dot in shalmaxb code when I run it through https://jsonlint.com/ as item suggested, and it throws an error, but if I simply remove the red dot it works fine.

    I suggest trying that and then copy and paste the "clean" code into your json file

  • item
    commented on 's reply
    Hello @telecastg
    Yes red point

    JSONLint is the free online validator, json formatter, and json beautifier tool for JSON, a lightweight data-interchange format. You can format json, validate json, with a quick and easy copy+paste.


    I have just add 2 braket and copy/past the code between braket

    Results

    Error: Parse error on line 8:
    ...yValidationList": []​ }}
    -----------------------^
    Expecting 'EOF', '}', ',', ']', got 'undefined'

    My experiment, each time you have error json and not see nothing anything, the json have special encoding bad caractère

    You then do not copy/past but write manually the 2 lines
    Last edited by item; 03-12-2023, 10:38 AM.

  • telecastg
    commented on 's reply
    Is that the red dot item ? How did you find it ?

    I checked shalmaxb posted code with Notepad++ and could not reproduce the error

    I also checked on my installation and I have an entityDefs file like this, working without any problems

    "startingDate": {
    "type": "datetime",
    "validationList": [],
    "mandatoryValidationList": []
    },
    "endingDate": {
    "type": "datetime",
    "validationList": [],
    "mandatoryValidationList": []
    },
    "firstExecutionDate": {
    "type": "datetime",
    "validationList": [],
    "mandatoryValidationList": []
    },
    Last edited by telecastg; 03-12-2023, 05:11 AM.

  • item
    replied
    special caractere at the end !

    Leave a comment:


  • shalmaxb
    replied
    Hi,
    thank you for your offer telecastg.
    Here is the field, that needs to bypass the validation:

    Code:
    "shippingCost": {
    "tooltip": true,
    "default": 10,
    "onlyDefaultCurrency": false,
    "conversionDisabled": false,
    "validationList": [],
    "mandatoryValidationList": []​
    },​
    but still on rebuild I get a json code error, which is not there, when I rebuild without the two lines. Version espoCRM is now 7.3.4

    Leave a comment:


  • telecastg
    commented on 's reply
    If it doesn't work, try checking the entitDefs custom script with your development platform/ editor to see if it detects any json structure errors. I use Eclipse from Apache and it will highlight json structure errors.


    Another option (just for you friend, because you always help everyone), post the code from 'custom/Espo/Custom/Resources/metadata/entityDefs/Quote.json' and I will take a look too.

  • shalmaxb
    commented on 's reply
    Thank you, then that is, why it does not work here, my client uses 7.3.2. Will recommend to him to update and then try again.

  • rabii
    commented on 's reply
    i think since version 7.3.3

  • shalmaxb
    commented on 's reply
    Since which version does this work?
Working...
X