Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field validations do not work at all on inline edit #9818

Open
gunnicom opened this issue Nov 15, 2022 · 2 comments
Open

Field validations do not work at all on inline edit #9818

gunnicom opened this issue Nov 15, 2022 · 2 comments
Labels
Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Type: Bug Bugs within the core SuiteCRM codebase

Comments

@gunnicom
Copy link
Contributor

gunnicom commented Nov 15, 2022

Issue

Any validation defined in vardefs does not work.

  • Add an integer field via Studio
  • Parameter the field with min value 0 and max value 10
  • Deploy the field in the views
  • Edit the object in edit mode: Validation works, you can not enter values greater than 10
  • Edit the object via inline edit: Validation does not work. You can enter a value like 99

Or if you define a custom validation in vardefs, like:

    'size' => '33',
    'validation' => 
    array (
      'type' => 'callback',
      'callback' => 'function(formname,nameIndex){
                           var fieldvalue=$("#" + formname + " input[name=" + nameIndex + "]").val();
                           var returncode=true;
                           if(fieldvalue.trim()!=fieldvalue){
                               add_error_style(formname,nameIndex,"Space at the start or end of value not allowed " + nameIndex); 
                               returncode= false;
                           }
                           return returncode;
			}',
    ),

It won't run on inline edt. It will though work on normal edit.

Expected Behavior

Validations should run also on inline edit.

Actual Behavior

Only "system" validations like validation if it is a number seems to run, but custom ones do not.

Possible Fix

x

Steps to Reproduce

  1. Add custom validation code to vardefs.php of a field
  2. Try to save in inline edit with invalid value
  3. Value save although it should be invalid
  4. Save the same value in normal edit view, validation works, won't save

Context

Your Environment

  • SuiteCRM Version used: 7.12.7, 7.12.8
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome 107
  • Environment name and version (e.g. MySQL, PHP 7): MariaDB 10.2.x, PHP 7.4
  • Operating System and version (e.g Ubuntu 16.04): Debian 11
@gunnicom gunnicom changed the title Custom validation do not run on inline edit (7.12.7) Field validation do not run on inline edit (7.12.7) Nov 17, 2022
@gunnicom
Copy link
Contributor Author

Easier to reproduce:

  • Add an integer field via Studio
  • Parameter the field with min value 0 and max value 10
  • Deploy the field in the views
  • Edit the object in edit mode: Validation works, you can not enter values greater than 10
  • Edit the object via inline edit: Validation does not work. You can enter a value like 99

@gunnicom gunnicom changed the title Field validation do not run on inline edit (7.12.7) Field validation do not validate on inline edit (7.12.7) Nov 17, 2022
@gunnicom gunnicom changed the title Field validation do not validate on inline edit (7.12.7) Field validation do not validate on inline edit Nov 18, 2022
@gunnicom gunnicom changed the title Field validation do not validate on inline edit Field validations do not work at all on inline edit Dec 21, 2022
gunnicom added a commit to gunnicom/SuiteCRM that referenced this issue Dec 22, 2022
Validations do not work on inline edit so disable inline edit for those fields to prevent faulty data.
salesagility#9818
gunnicom added a commit to gunnicom/SuiteCRM that referenced this issue Dec 22, 2022
@johnM2401 johnM2401 added Type: Bug Bugs within the core SuiteCRM codebase Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds labels Jan 5, 2023
@SuiteBot
Copy link

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/make-field-required-based-on-another-field/90250/7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Type: Bug Bugs within the core SuiteCRM codebase
Projects
None yet
Development

No branches or pull requests

3 participants