Add popup when data not entered in a required field

1
I would like to add a popup to a field that is already marked as required in the validation settings.   When i made a microflow to show a message if data is not entered, the message does not show as all that happens is the field will go red due to it being marked as required, so it isnt actually progressing to call the microflow.   I still want to be able to have the field display in red with a label if its not entered but i also want a pop up so the user knows to enter the data – i made a microflow as i said on the save event but it doesnt call the microflow rather just goes with the standard required process of showing field as red and your empty message set.   any help much appreciated! thanks
asked
5 answers
0

Hi Mathew,

 

if you are not using above dynamic class condition your output will be like this:

 

 

if you are using dynamic class condition then output will be

 

 

answered
2

Hi Matthew, 

 

Mendix runs the validations, “basically” in this sequence:

1 – UI Pages/Widget validations 

  • The following process / any post action / buttons calls, only happens if all validations are successful 

2 – Entity Validations Rules

  • This validations are checked on every commit action (from forms or actions within microflows/nanoflows)

3 – Microflows/Nanoflow

  • Validation feedbacks or custom Validators 
  • If called direct from a Button it shows up first
  • From a Entity Event Handler – Its only invoked if Entity Validations Rules pass first.

 

Resume: Mendix best practices suggest to keep all validations within a Microflow, to avoid duplicated validations and validations showing up partially…

 

Check this https://medium.com/mendix/expert-validations-in-mendix-10e1bdfc7bc0

 

Alternatively check this module – https://marketplace.mendix.com/link/component/110282

Its can add some extras features to your MF validations as well show up the Missing/Required fields in a popup window.

 

Best regards

 

answered
1

Hey Matthew,

 

I’ve not yet seen the combo of marking a field as required + call a microflow to show a message since the required mark won’t let you go through with a Microflow. Although this could probably be possible by adding an Event on change by Microflow to that field but I found that it’s not that nice for the user experience

 

What i’ve done is put validations on fields which require just any input and for validation which need extra business logic I do the validation in a microflow on Save

 

Example:

Customer name is validated through validation on the field itself,

 

Customer Email can not be the logged in users email so for this i do the validation on Save and use a decision step for the validation. If true → Show info message, If false → go through with the Save

 

Hope this gives you some inspiration

 

answered
0

Hi Mathew,

 

You can check this idea but it will be good if we have 1 or 2 fields. if we have more field then we have to go for different approach.

 

Add one boolean attribute to the domain model with default value true. On click of save , if the field value is empty update this boolean variable to false.

 

In your field widget add dynamic class like this in appearance tab.

 

Define the below CSS definition in input.scss file

 

.mandatory {
    border: 1px solid red !important;
    padding:0px !important;
}

 

answered
0

Alternatively you can do this with just creating an overlay and change the styling. Create an overlay, add some title and text and container for the validation-messages.

answered