Re: validation in Subroutines (2469 Views)
Reply
Regular Advisor
SHOHAIB
Posts: 123
Registered: ‎08-01-2011
Message 1 of 6 (2,497 Views)

validation in Subroutines

Hi ,

 

Validation need to perform in FC subroutines

 

I have a field $min

 

if user enters the values above 60 , popup should appear "Please eneter between 0 to 60"

 

how to do it in subrotines

Honored Contributor
Jacob Heubner
Posts: 4,177
Registered: ‎07-21-2008
Message 2 of 6 (2,474 Views)

Re: validation in Subroutines

First - why are you doing this in subroutines? The subroutines panel in the formatctrl record is where you can tell the system to run specific RAD applications to perform functions on this record, or to do post-processing actions (like calling a script or posting data into another record.)

 

The validations panel is where you would perform validations. And for validations, if it were me, I'd set up two validations like the following:

 

Add: not null($min)

Update: not null($min)

Validation: $L.void=rtecall("isnumeric", $L.rc, $min)

Message: Please enter a numeric value between 0 and 60

 

Add: not null($min)

Update: not null($min)

Validation: $min<=60 and $min>=0

Message: Please enter a value between 0 and 60

 

The first validation checks to make sure the user entered a number, and the second validation checks to make sure it's between 0 and 60, inclusive.

 

Why would you want to do this with a subroutine?

 

Regular Advisor
SHOHAIB
Posts: 123
Registered: ‎08-01-2011
Message 3 of 6 (2,471 Views)

Re: validation in Subroutines

Hi,

It was working good in FC vaildation,
Can you tell me how to restrict for special characters
Honored Contributor
Jacob Heubner
Posts: 4,177
Registered: ‎07-21-2008
Message 4 of 6 (2,469 Views)

Re: validation in Subroutines

The isnumeric rtefunction will ensure the value in the field is a number.  That will exclude anything that isn't a number.

 

If you want to _include_ special characters, the isnumeric function allows you to pass a comma delimited string of characters to allow.

 

$L.void=rtecall("isnumeric", $L.rc, $min, "#,$,%,^,&,*")

 

Will allow any of the characters listed as well as any number; however, your second validation will fail, becuase $4 is not a number between 0 and 60.

Regular Advisor
SHOHAIB
Posts: 123
Registered: ‎08-01-2011
Message 5 of 6 (2,464 Views)

Re: validation in Subroutines

Hi ,

for this one

Add: not null($min)

Update: not null($min)

Validation: $L.void=rtecall("isnumeric", $L.rc, $min)

Message: Please enter a numeric value between 0 and 60

if i enter numberic value , message is getting displayed
Regular Advisor
SHOHAIB
Posts: 123
Registered: ‎08-01-2011
Message 6 of 6 (2,435 Views)

Re: validation in Subroutines

Hi ,

 

when i use this below validation in fc it was not showing the error message for >,<,=,#

 

validation - rtecall("isnumeric", $L.rc, $hr, "#,$,%,^,&,*")

update - not null($hr)

Message - Special Characters , Alphabets are not allowed

Set Focus To - $hr

 

Please help me.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.