-
1. Re: Validation for a semicolon in a PopUp LOV
Pavel_p Sep 13, 2018 12:57 PM (in response to Tod Goulds-Oracle)Hi Tod,
I can't reproduce it in 5.1.4 and 18.1. either - validation on Popup LOV works exactly as expected (no matter if it's defined in shared components or as Static values: STATIC:with semicolon;a;b,semicolon only;;,without semicolon;ab). Please, could you describe in more detail what you did and what APEX version you're using?
Thanks
Pavel
-
2. Re: Validation for a semicolon in a PopUp LOV
fac586 Sep 13, 2018 7:25 PM (in response to Tod Goulds-Oracle)Tod Goulds-Oracle wrote:
I have created a validation on a PopUP LOV, that also allows free text entry to check that there are no semicolon values in the item...
Validation used:
"Item does NOT contain any of the characters in Value"
Value used:
;
however this doesn't work, (actually causes a page issue)... is there any way to check this is there some kind of special string to check for a ;
I cannot reproduce any problem either. What is the "page issue" referred to?
-
3. Re: Validation for a semicolon in a PopUp LOV
Joe Upshaw Sep 14, 2018 12:57 PM (in response to Tod Goulds-Oracle)1 person found this helpfulWarning...javascripty answer.
To enforce a "White List" of allowable characters, I do the following:
- Add a class to the input on which I'd like the validation to be active, regularExpressionCheck
- Add an additional property to the input, regularExpressionMatch
- The value of the property in my case it set to an application item, regularExpressionMatch="&ALLOWABLE_DATASET_REG_EXP." but, you couold hard code one here. For me, this item, ALLOWABLE_DATASET_REG_EXP, is set to [^A-Za-z0-9_], i.e. just letters, numbers and _.
- Then I have a bit a JS to check if the value matches the RegExp whitelist.
function regularExpressionCheck( validationValue, validationDisplay, regularExpressionMatch ) { var testRegExpObj = new RegExp( regularExpressionMatch ); var hasUndesiredContent = testRegExpObj.test( validationValue ); if( hasUndesiredContent === true ) { var invalidCharacters = ''; var currentForbiddenCharacter; while ( (invalidCharacterArray = testRegExpObj.exec( validationValue ) ) !== null ) { currentForbiddenCharacter = invalidCharacterArray[0]; if( invalidCharacters.indexOf(currentForbiddenCharacter) === -1 ) { invalidCharacters = invalidCharacters + currentForbiddenCharacter; } validationValue = validationValue.substr( testRegExpObj.lastIndex + 1 ); } this.errorMsg = validationDisplay + ' contains disallowed characters: "' + invalidCharacters + '"'; this.cellHasError = true; } else { this.cellHasError = false; } }
So, to call this, I just find any elements with this class, whenever one if found, I call:
regularExpressionMatch = $(childNode).attr("regularexpressionmatch"); validationCheckObj = new regularExpressionCheck( childValue, displayHeader, regularExpressionMatch );
If the validation object has an error, raise it.
if ( validationCheckObj.cellHasError === true ) { conditionallyAddError( validationCheckObj.cellHasError, $(childNode), $(childNode).attr('id'), validationCheckObj.errorMsg, errorList, internalErrorCnt, errorClass ); errorCnt = errorCnt + 1; }