Want to activate a button only if certain fields are valid

Hi,
I’m trying to activate a continue button only after specific fields have been filled as valid. I’m using panel states to determine if they are valid and have my case set up like this

54%20PM

In this instance I only seem to be able to get it to work (see second page Job (1)) after one fields is activated. I’ve had other instances where it’s working if I change to “Match Any” vs. “Match All” but that still doesn’t do what I want (only activates if 2 of 3 are valid vs. 3 of 3) and isn’t even working here in this instance. What am I doing wrong?
08_Check if all fields valid before activating button.rp (759.7 KB)

ELSE IF cases only get evaluated if the previous one is not true. If you right-click on an ELSE IF, you can turn it into an IF, meaning it will always get checked when the field loses focus, regardless of whether any of the previous cases have fired. In this case it looks like the logic may not fire if any of the previous ELSE IF cases kicks in.

In general, I’d recommend moving ‘whole form’ logic like this to a hidden widget, so it’s all in one place, then firing click events at that hidden widget. So, every time any of the form dynamic widgets changes state, you could then fire a click at the hidden widget. It can then check whether all of the states are set to valid and if they are, enable the continue button. This means you’re not dependent on the user going through the fields in order, and it means the logic is only in one place and so easier to update.

Another tip - for buttons, you can use enabled/disabled widget style effects, rather than dynamic panels - it’s a lot easier.

Hi Dave,

Thanks. So I think implementing the ‘whole form’ logic with fire events is still a bit beyond where I am with Axure but aside from that I still don’t understand why setting up a case to “Match All” based on if two panel states are both valid (I’ve tried a case where it triggers if = valid as well as if doesn’t = valid) and it not working. For this example I’m setting up a case in a dummy field that focuses on click of the button or tab after the last field. Here it’s the only case so there’s really no IF/ELSE IF cases getting in the way. I just can’t seem to get or don’t understand the logic behind setting things to “Match All” as it doesn’t seem to work. If I set it to “Match Any” it’s only checking one out of multiple fields I need to be valid so at least it seems to follow the logic but that’s not what I want.

Here’s the file I’ve been playing with: 08_Check if all fields valid before activating button_V2.rp (623.1 KB)

And thanks for the tip about style effects vs. panels! (still set up as panels here).

Ah, right, I think I understand. If you swap the test on your dummy field it should work as expected.

So, instead of checking whether the dynamic panels are NOT set to valid, then going onto the Continue state, do the opposite. Check if they are valid (and if so, set the button to Continue) then if they are not, set the error state.

The reason I would recommend using ‘Fire event’ rather than focusing a dummy field is to avoid issues like the above, where it’s not clear why something is not firing.