on 03-25-2009 6:29 PM
Hi,
I need 2 type of validations to happen in a single column where user enters his input.
My column will have both whole numbers and percentages.I can identify these with a key which i have in internal table.
when it is a percentage and when user tries to enter more than 100 like 12131 I should get a validation pop-up a message saying please enter % value less than 100.
How do I handle this?
Rgds
Praveen
Hi,
Try this logic in JavaScipt (in 'validation' or 'exit' event of the field),
if(key == "percentage")
{
// Validation script for Percentage
if(!(percentVal>0 && percentVal<100))
{
xfa.host.messageBox("Invalid Percentage! Please enter the correct value(0-100%).",
"Error in Percentage",0,0);
<Field>.rawValue = null;
xfa.host.setFocus("<Field>");
}
}
else
{
// Validation script for whole number
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prabhakar,
I am trying to implement your code.
My column which is user input is A field but my key field is another field in same internal table and it is B
I am expecting that I should place code in A validate/exit script.
But i can't access key field B inside A script.
if(ADOBE_DATA.ItemForm.ITEMP.DATA.B == "% installed")
{
// Validation script for Percentage
if(!(percentVal>0 && percentVal<100))
{
xfa.host.messageBox("Invalid Percentage! Please enter the correct value(0-100%).",
"Error in Percentage",0,0);
<Field>.rawValue = null;
xfa.host.setFocus("<Field>");
}
}
How should I overcome this issue?
Rgds
Praveen
Edited by: PRAVEEN s on Apr 1, 2009 10:21 PM
Hi Praveen,
Try this code, Place it in Field A's validation or Exit event.
var BVal = xfa.resolveNode("ADOBE_DATA.ItemForm.ITEMP.DATA["+this.parent.index+"].B").rawValue;
var percentVal = xfa.resolveNode("ADOBE_DATA.ItemForm.ITEMP.DATA["+this.parent.index+"].A").rawValue;
if(BVal == "% installed")
{
// Validation script for Percentage
if(!(percentVal>0 && percentVal<100))
{
xfa.host.messageBox("Invalid Percentage! Please enter the correct value
(0-100%).","Error in Percentage",0,0);
xfa.resolveNode("ADOBE_DATA.ItemForm.ITEMP.DATA["+this.parent.index+"].A")
.rawValue = null;
xfa.host.setFocus(xfa.resolveNode("ADOBE_DATA.ItemForm.ITEMP.DATA["
+this.parent.index+"].A"));
}
}
xfa.resolveNode() -> reeturns the object from string
this.parent.index -> current instance number (i.e. row index)
<Field>.rawValue -> returns the value inthe field.
Regards,
Prabhakar
Hi,
You can easily handle this by checking this validation is SAP. u can check the im_value in field exit
and then if it is greater then 100 then give any error message
If im_value > 100.
ex_response = 'A'.
ex_mess_num = '999'.
ex_msgvar1 = 'Please enter number in percentage less then 100'.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do this easily using JavaScript code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.