cancel
Showing results for 
Search instead for 
Did you mean: 

Client validation

popeye
Champ in-the-making
Champ in-the-making
Is there some client validation that can be performed, e.g. the user edits some metadata values => now I want to limit the number of characters or just allow a maximum integer value for certain properties => is there a way to realize this in OpenWorkdesk?
3 REPLIES 3

vahe
Champ in-the-making
Champ in-the-making
Hi Popeye,
yes we have a concept in OpenWorkdesk that supports your requested client validation. There is a JS file "common.js" that is located in your repository in the folder "js". This JS file has a method "onCustomValidation()" that is always called after the user has entered some text into a input field => here you can implement your validation, e.g. limit the text length of the property "cmis:document.cmis:name":

function onCustomValidation (classname, javaclassname, fieldprovidertype, fieldprovidername, fieldid, value)
{
if(classname=="cmis:document.cmis:name")
{
if(value.length>10)
{
//limit the string to the first 10 characters
document.getElementById(fieldid).value=value.substring(0,10);
return(" The maximum length of this property should be less than 10 characters.");
}
else
{
return(null);
}
}
return(null);
}

popeye
Champ in-the-making
Champ in-the-making
OK thanks, that sounds good and covers most of my requirements. But is there also a way to disable the save button…I really don't want to allow the user to save the changes…

chfi
Champ in-the-making
Champ in-the-making
It is possible to block the save button, but it does not appear to be possible to block the enter key in all cases from submitting the form.
Here is a code snippet how to disable the save button in the common.js:
document.getElementById('<NameOfYourButton>).disabled=true;