Want a Screen Action to enable/disable fields based on check box click

Want a Screen Action to enable/disable fields based on check box click

  

Hi,

We're evaluating OutSystems and building our minimum viable product as part of this process.  We've got one fairly simple thing we want to do.

We're starting out with basic customer management, we've got home address and mail address fields, we have a check box that indicates 'mail address different from home address' for those customers who have mail send somewhere other than their home address (such as a PO Box etc).

What we'd like to do is this:

By default the check box set to boolean value of False and as such we'd like the 'mail address' fields to be disabled and set to blank.

If the user clicks the checkbox (MailAddressDifferent) we'd like the 'mail address' fields to be enabled and available for editing.

I'm fairly certain that this is a 'Screen Action' as the destination for the checkbox field but am not enitrely sure how to implement this in the screen action.

Any tips would be most appreciated.

Thankyou Kindly for reading our query,


John 

Solution

Hi John,

You can do that by doing:

  • Inserting your input fields into a Container
  • Give a name to the Container (e.g. ContainerWithFields)
  • In the input fields set their Enabled property to the boolean variable of the checkbox (e.g. IsEnabled)
  • In the OnChange property of the CheckBox add a new Screen Action
  • In that screen action add a Ajax Refresh statement. Choose the Container that has your input fields (ContainerWithFields).

This will:

  • when you click on the check box and change its value it will execute the Screen Action
  • In the Screen Action it will refresh the input fields
  • Since the input fields have their enabled property dependent on the value of the check box, they will be enabled when the checkbox is ticked and disabled otherwise.

Check the attached oml for something similar.

Was this what you were looking for?

Cheers,

José

Solution

Hi Jose,


Thankyou so much for your kind and well thought out advice.  That indeed is doing the trick!  I put the fields I wanted to toggle on and off into a container and referenced that in the screen action AJAX refresh, that was the bit I was missing.

I then created a wrapper container for all of the fields and made the whole container visible/not visible based on the checkbox :)

Now the form is dynamic, which is exactly what I wanted :)

Thankyou :)

-John