Navigation Tabs Built-in Validation on tab change
Question
Application Type
Reactive
Service Studio Version
11.10.10 (Build 38777)
Platform Version
11.11.0 (Build 27311)

I have Navigation\Tab inside a form (say 2 tabs). In each tab I have text inputs. I would like to perform built-in validation (yes) while user changing the tabs (default OnTabChange event). How to achieve this? We don't have built-in validation property for OnTabChange event.

If it is form submission through button, I can set built-in validation through property. However I am not able to do this when I am trying to validate the inputs via OnTabChange.


Any possible way to achieve this?

Champion
Solution

Hi Arunkumar,

I looked at your OML and found that when you are entering wrong input at first, the Input_Input1.Valid property is becoming False, which is correct. But when you are entering correct input, at that time you are not assigning Input_Input1.valid property to true, hence it remains as False which is causing Form.Valid also to be False.


Solution:

Assign Input_Input1.Valid =  True after True branch of IsNumber condition to make it valid, and then your problem would be solved 

Input_Input1.Valid = True

Your flow should look like this :


Here i have attached the same OML for your reference:

You can also checkout its working link : https://shweta-gedam.outsystemscloud.com/NavigationTabValidation/NavigationTabValidation?_ts=637490899613344685

Hope it helps, Thanks :)

NavigationTabValidation.oml

Hi Shweta, This solution looks cool. 

So when we can't force built-in validation this is the only way to set valid status of input control and in-turn form?

In normal case, when button or link submits the form (builtin validation turned ON), usually I set only the validation failure status. The other case automatically handled.

But this is different, we don't have built-in validation ON, so we have to set it explicitly. Am I right?

Champion

Yes Arun, As we don't have built-in validations property associated with your OnTabChange event , this is the easiest way you can use to accquire your result by setting it manually inside work flow.

This solution will definately work in your case. And you can mark it as a Solution.

Thanks and Happy Coding!!

I have attached screens to explain my problem.



I have a form which contains tab1 and tab2

tab1 contains input which suppose to contain only number (considered for simple validation)

Validate button to check form valid status

Valid status will also be checked in TabOnChange event

Scenario 1:

Enter text in input and try to change the tab or click on Validate button. It gives form invalid message as its supposed.

Scenario 2:

Once the form is invalid try change the input to number and click on validate button.

Form turns to valid as it supposed.

Scenario 3:

Once the form is invalid try change the input to number and try to change the tab.

Form is still invalid., which is the issue.

On TabOnChange event I am setting valid status of input if it contains numbers. However it is not changing the form's valid status, which is the issue here.

And why is that? Please help. I have attached the OML too




NavigationTabValidation.oml

Hi Arunkumar Balu,

The problem is with you IsNumber validation step. It tests if (Num1 = "" or TextToIntegerValidate(Num1)). If it is False (Num1 not empty), it sets the Input_Input1.Valid to False. So, you have to change two things:

  • Num1 = "" or not TextToIntegerValidate(Num1)
  • Swap Connectors

You could also change the Input_Input1 Input Type property to Number to help your validation process.

Hope it helps.

Best regards


No. It tests for 

Num1 = ""
or
TextToIntegerValidate(Num1)

the input can be empty. If its not empty then it should be convertible to integer. If either True then form is valid. Thats the logic. So the current branch is correct.  

Yes i can set the datatype as integer. But thats not the point.

Please replicate following scenario.

1. Enter text (abc) in input box

2. Click on tab2. This throws the validation on input.

3. Now change the input to a number (123). Now change the tab. You the validation error still stays on the screen.

You can click on Validation button, if you do, validation error goes away.

However, both button click, Tab change calls same client action "TabsOnTabChange"

The only difference is, button has built-in validation property that can be set as Yes/No. In this example the property is Yes.

That makes me to think, is there any way to force Tab OnChange event to perform built-in validation.



Champion
Solution

Hi Arunkumar,

I looked at your OML and found that when you are entering wrong input at first, the Input_Input1.Valid property is becoming False, which is correct. But when you are entering correct input, at that time you are not assigning Input_Input1.valid property to true, hence it remains as False which is causing Form.Valid also to be False.


Solution:

Assign Input_Input1.Valid =  True after True branch of IsNumber condition to make it valid, and then your problem would be solved 

Input_Input1.Valid = True

Your flow should look like this :


Here i have attached the same OML for your reference:

You can also checkout its working link : https://shweta-gedam.outsystemscloud.com/NavigationTabValidation/NavigationTabValidation?_ts=637490899613344685

Hope it helps, Thanks :)

NavigationTabValidation.oml

Hi Shweta, This solution looks cool. 

So when we can't force built-in validation this is the only way to set valid status of input control and in-turn form?

In normal case, when button or link submits the form (builtin validation turned ON), usually I set only the validation failure status. The other case automatically handled.

But this is different, we don't have built-in validation ON, so we have to set it explicitly. Am I right?

Champion

Yes Arun, As we don't have built-in validations property associated with your OnTabChange event , this is the easiest way you can use to accquire your result by setting it manually inside work flow.

This solution will definately work in your case. And you can mark it as a Solution.

Thanks and Happy Coding!!

I understand the problem, now.

The thing is that to activate the built-in validation you must set the Built-In Validations property of the Event that submits the data to Yes. But, you can only do that in Link or Button widgets. Thats why it is not working properly.

So, in order to make it work using Tabs, you will need to do as Shweta Gedam said and set the Input_input1.Valid to True on the True branch.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.