Facing issue with Spreadsheet cell value validation check (empty and compare)

Posted by: adrian on 4 March 2020, 3:51 am EST

  • Posted 4 March 2020, 3:51 am EST

    Hello,

    We are using spreadjs and facing issue with cell value validation. we need to compare cell value to check it’s empty and compare with other value after that highlight that specific cell and need to display error message on button click, So can you please provide me example that how can we implement it.

    Below is example that i have implemented and greater then numeric value condition is working but empty cell value and compare cell value validation is not work.

    spread.options.highlightInvalidData = true;
    			var dv = GC.Spread.Sheets.DataValidation.createFormulaValidator("A1>0");
    			dv.showInputMessage(true);
    			dv.inputMessage("Enter a value greater than 0 in A1.");
    			dv.inputTitle("Tip");
    			dv.showErrorMessage(true);
    			dv.errorMessage("Incorrect Value");
    			spread.getActiveSheet().setDataValidator(1, 1, dv);
    

    Thank you

  • Posted 5 March 2020, 1:56 am EST

    Hi,

    The code line " sheet.setDataValidator(1, 1, dv);" apply the validation for Cell B2. The cell B2 will be highlighted once you enter the Incorrect value for A1 Cell.

    To apply validation on A1 cell, please use " sheet.setDataValidator(0, 0, dv);". The SpreadJS indexing works from 0.

    Regards,

    Manish Gupta

  • Posted 5 March 2020, 4:19 am EST

    Hello manish.gupta,

    We know that things but we want to check condition B2 cell is empty or not and we want check one more condition that is compare cell value with another static value.

    So can you please provide me functions or sample code for check empty cell or compare cell value.

    Thank you,

    adrian

  • Posted 6 March 2020, 6:49 am EST

    Hi Adrian,

    You may use the following formula to apply validation based on some other cells.

    AND(NOT(ISBLANK((A1))),B1>10)
    

    Please also refer to the attached sample validation.zip for reference.

    Regards,

    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels