Jump to content
Server Maintenance This Week. ×

Conditional formatting & processing api response


This topic is 3644 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I created a VAT field. Now I would like to use conditional formatting when I enter a VAT number. I want it to make the color of the text green if the VAT number exists, and make it red if the VAT number doesn't exist/wrong number.

 

To do this, I can use a calculation together with conditional formatting. However I need to send a request to an api and catch the response. Let's say it returns "1" if the VAT number was found, and a "0" if the VAT number can't be identified. Then it will be easy to handle it in the calculation. How can I talk to an API and let the conditional formatting behave according to the response? 

 

EDIT: 

Found it I think. I have an API that outputs "true" or "false" if the VAT is valid or not.

If I create a (hidden?) web viewer, and update the webview each time with the new url when I leave the VAT field. Then I can use the GetLayoutObjectAttribute to get the content of the web viewer. And if that content contains true, then should a script update the color of the VAT field with a green color, otherwise red.

 

I can execute the "Insert from URL" function in a script when I leave the field. This will insert true or false inside a hidden field. I use conditional formatting on my VAT field (green if hidden tmp field is "true" and red if "false"). 

 

I have one question left. I validate my VAT number when I leave the field, but also when I load the layout. However, when I load the layout I first have to click in a random field until the VAT field updates his conditional formatting. Any way I can refresh this field's formatting in a script? I can't let the script go to a field, because when I load the layout I don't have a field selected, and on the other hand when I'm filling in form fields I want to go to the next field after the VAT field (and not visit field #1 again).

Link to comment
Share on other sites

This topic is 3644 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.