Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to switch off validation of a field using guidebridge?

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

15-10-2015

In an adaptive form I want to hide fields that are not relevant anymore because of values in other fields.

Example: In the country I live children have a legal representative until they're grown up. If on a form somebody enters a birth date which indicates that he's older than 18 years the field demanding the name of his legal representative becomes obsolete. Such a feature is what I understand by adaptive form!

The only way I've found so far to accomplish this is :

* do not use the mandatory flag (because a field is always mandatory even if it's not visible)

* check in field's validation expression whether it is visible at all: if it is visible check its value else validation expression returns true

What I would like is a way to switch validation off by guidebridge in a elementVisibleChanged event. Is this possible? (The guidebridge documentation is deceptively incomplete for such questions.)

Thank you,

Urs Hofmänner

Replies

Avatar

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile
varundua
Level 2

15-10-2015

Hi 

You can use the validationsDisabled property of a Field to switch off validations. In your example, you can write in the value commit expression of the birthdate field 
 

if ( checkIsabove18 ) { // replace checkIsAbove18 with an actual check
    legalRepresentation.visible = false; // assuming the name of the legal representation field is legalRepresentation. If not change this with the actual name
    legalRepresentation.validationsDisabled = true;
} else {
   legalRepresentation.visible = true;

   legalRepresentation.validationsDisabled = false;

}

Hopefully it solves your problem.

Happy to Help
Varun Dua

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

15-10-2015

Hi Varun 

thanks a lot for your response.

I didn't know the field's validationsDisabled property.

I'm using in a generic way:

window.addEventListener("bridgeInitializeStart", function(event) { var gb = event.detail.guideBridge; gb.connect(function() { gb.on('elementVisibleChanged', function(event, data) { var widget = guideBridge .resolveNode(data.jsonModel.target.somExpression); if (widget.className == 'guidePanel' || widget.className == 'guideTextDraw') { return undefined; } if (data.jsonModel.newText) { widget.validationsDisabled = false; } else { widget.validationsDisabled = true; } }); }); });

With this code I can enable/disable validation depending on its visibility.

Regards,

Urs

Avatar

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile
varundua
Level 2

15-10-2015

Hi Urs,


May I know how you are hiding the field ? Are you using the Visible Expression or the Value Commit Expression. In your use case using Value Commit Expression will give better performance.

Regards
Varun

Avatar

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile
varundua
Level 2

15-10-2015

Also jsonModel property is internal and you should directly use 

data.target.somExpression

data.newText

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

15-10-2015

In the visible expression (of the depending field)

Because it's a fields responsibility to know whether it's obsolete or not.

Better explained by the example: 
I want that the 'legal representative' field "knows" whether it's relevant or not and not that the 'birth date' field must update all other fields if the age is greater than 18.