cancel
Showing results for 
Search instead for 
Did you mean: 

Validations message- Interactive form - column

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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
   }

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

You can do this easily using JavaScript code.