Can someone help me with CellEdit client script ...with an example ???

s_kumar
Mega Contributor

Can someone help me with CellEdit client script ...with an example ???

1 ACCEPTED SOLUTION

Hi Sandeep,


onCellEdit is a function that is used in the case of a list. If you want to write some script that should be executed on a list then you can do that by using onCellEdit function.



In my previous example:



It is checking in one field whether it is having the same old value or new value and if success then returns a success using the callback function.



Another small example for you:



The script below runs on the State field and prevents users from changing the State to closed in a list.   Hope this helps.



function onCellEdit(sysIDs, table, oldValues, newValue, callback) {


    var saveAndClose = true;



  if(newValue == 7){


  alert('Not allowed');


  saveAndClose = false;


  } else {


  saveAndClose = true;


  }



callback(saveAndClose);


}


View solution in original post

16 REPLIES 16

oncellEdit   will work only on list not on form.If you want the thing on form(UI) then you have to write an onchange script along with this oncellEdit script for that.


eg:


function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue == '') {


          return;


    }


  //Type appropriate comment here, and begin script below


if(newValue == "test2")


              {


              alert("Not allowed");


  g_form.clearValue('u_cell');//replace u_cell with your field name


  }



   


}


Below example works in change management module:click on all(list will displayed) then try to change the priority



PS: g_form.addInfoMessage(" Hello World");     not working onCellEdit() can some some tell the reason for this