Hi all,
I need to validate that in a texfield, the user on type characters, I mean (100k, 80k, ect), numbers with text values.
if the user enters 10k,20k like in textfield, I have show some validation message,How could I achieve this,
is there a special functions?
Can anyone help me please on priority?
Discussion posts and replies are publicly visible
Hi JS0001,
One suggestion here is that we can directly use the integer field. If there is a different constraint, I have added the code for validation for the text field you expected below.
{ a!textField( label: "Text", labelPosition: "ABOVE", value: ri!text, saveInto: ri!text, validations: if( and( a!forEach( items: code(ri!text), expression: and(fv!item >= 48, fv!item <= 57) ) ), "", "Enter a valid number" ) ) }
Hi, this works for integer data type, But in my case I have number(decimal) data type.If I use this validation it is not working for me,what to do?
In the case of decimals, use the decimal field component which has inbuilt validations to avoid text
https://docs.appian.com/suite/help/23.3/Floating_Point_Component.html
No, If I use floating-point component still not working,The value is vanishing if I enter 10k instead of giving 10
a!floatingPointField( /*label:"Face Value"*/ value: rule!CR_FN_setDecimalValues( value_dec: index(fv!item, "faceValue_dec", {}), decPlace_int: 2 ), saveInto: fv!item.faceValue_dec, readOnly: local!releaseDeleteReadOnlyBool, required: rule!CR_APP_FN_requiredConditionsForDocumentaionUnit( crAppSelectedItem_cdt: fv!item, role_txt: ri!role_txt, isRequired_bool: ri!isSecurityCollateralReq_bool ), validations:{rule!CR_FN_setValueGreaterThanZeroValidation(value_dec: fv!item.faceValue_dec), if(a!isNullOrEmpty(stripwith(local!faceValue,"0123456789")),"","Enter a valid"), } ),
Let me ask you a question. Why do you want the user to enter something like "10k" instead of a real number like 10000? Or is that just you, abbreviating your writing here?
Unknown said:Why do you want the user to enter something like "10k"
I have a hard time telling from the phrasing of the original post, but it almost looks as if to me as if they want to validate the user does NOT enter numbers like that.