Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
How Can I validate cells?
posted

Hi,

I want to validate some cells in a ultrawebgrid in the client side, how can I do that?.

I tried the follow code, but it validates all ultrawebgrid's cells

function grdPrincipal_BeforeExitEditModeHandler(gridName, cellId, newValue) {
var cell = igtbl_getCellById(cellId);
var grid = igtbl_getGridById(gridName);
var currentValue = cell.getValue();
if (newValue == null || newValue == '') {
alert('');
EditCell();
return 1;
}
} 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Can you help me please.

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Parents
No Data
Reply
  • 5739
    posted

    Hi,

    Here's a validation function that I use in a production site.

            function CheckFormsForErrors() {
                var grid = ig_controls["ctl00_ContentPlaceHolder1_WebHierarchicalDataGrid1"];
                var totalrows = grid.get_rows().get_length();
                if (totalrows == 0) {
                    return true;
                }
                for (c = 0; c < totalrows; c++) {
                    if (grid.get_rows().get_row(c).get_cell(7).get_value() == null || grid.get_rows().get_row(c).get_cell(7).get_value() == '') {
                        formnum = grid.get_rows().get_row(c).get_cell(3).get_value();
                        errorstext += 'Form ' + formnum + ' press must be chosen. ';
                    }
                }

            }

    You would put a return false in place of the errorstext that I use.

    Ed

Children