All fields required

I’m looking for a way within my submit button to have code or something that says it requires all the text boxes on the screen to have information in them before submitted to the database.

Id recommend making a custom method on the button called validateInputs or something. Have that check all the values for the input fields, then you can call that method in the event for the button.

You can check each field in the event instead if there aren’t many, but depending on the size of the screen, I lean towards making a separate method.

I would tend more towards adding a custom property to each of the fields called something like ‘isValid’ and having each component decide if it has a valid value or not. Then I would bind these properties to the button’s enabled property, or via a proxy custom property on the window root (or somewhere logical) to combine these together first. The biggest benefit in this method is being able use the valid state(s) in bindings, and do things like highlight items that are not valid, as well as disabling the submit button.

2 Likes