Open digiscapeuk opened 4 days ago
Hello @digiscapeuk,
Thank you for your inquiry. Do you wish to be able to specify the 'warning' validation mode for a particular form element? For the record: you can disable the survey.validationEnabled
option for the entire survey. Regardless of the validation errors, users will be able to submit a form.
Yes it would be specific validations only.Consider a form with a number of questions. A question may have a validation that says it is required to have a value if another question has a value.In some cases we want to prompt the user on save that there is an issue but still allow them to ignore the warning prompt and save as they may not be able to answer at that time.This would be an option to toggle against specific rules rather than for the entire survey.A workaround I’m considering is to add a custom item type for “warning” that derives from the HTML input. We could then define rules that make it visible if a rule is broken and then custom code on save could prompt the user with a summary of all warnings.ThanksOn 22 Nov 2024, at 17:20, Jane @.***> wrote: Hello @digiscapeuk, Thank you for your inquiry. Do you wish to be able to specify the 'warning' validation mode for a particular form element? For the record: you can disable the survey.validationEnabled option for the entire survey. Regardless of the validation errors, users will be able to submit a form.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
@digiscapeuk Why don't use requiredIf
functionality for this case?
Thank you, Andrew
In many cases that would work but there are scenarios where a rule exists but a user needs the ability to override.To be more specific consider a form used in a health setting. The will be rules that define the data validity but at the point of initial completion the data may not be available and blocking the user from saving what they can is not desirable.We can warn the user validation issues exist but they can choose to save any way and a later process would see them have to revisit the form in order for it to be submitted as valid/complete.I’m happy to concede it might be a specialised use case and I should code for it myself - I was really asking to be sure it’s not something that has already been considered.Sent from my iPhoneOn 22 Nov 2024, at 18:43, Andrew @.***> wrote: @digiscapeuk Why don't use requiredIf functionality for this case? Thank you, Andrew
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
@digiscapeuk Could you please describe your scenario in more detail? It would be better to be more specific, for example, stating that question 1 depends on question 2. If the value in question 2 is X, then question 1 should have a value like...
There are many options available, and I believe you can create a good UI using a combination of existing options along with some coding. Here are some statements:
There are numerous options available.
Thank you, Andrew
Certainly I can do it with code but it would perhaps be neater for maintenance if the logic is kept with existing validations.An example for a clinical assessment form which is a living document within a workflow which means it gets edited multiple times:Q1 might be the appointment date and Q2 could be a diagnosis code.Q2 becomes required once Q1 is <= today.The form could be lengthy and have lots of questions with validations that are mostly mandatory - it’s only specific rules that can be ignored.On save, the user should be prompted that rules are broken.The normal case is that we block save when rules are broken but there are some use cases where we want the user to be blocked from save if critical rules are broken but specific validations will warn the user but we still allow them to save. It could be a busy clinic and they don’t have all the data but they need to save the data entered so far.Later in the workflow they would again be prompted on each save to fill out the missing data.I can easily add code on save to store the data even if rules are broken but to have specific validations warn but allow save id need to set an extra attribute on the specific validation rules or handle it another way.I can think of lots of ways to implement this manually but my validation rules would then be split across the existing validation rules and some other custom item added to store optional rules that should otherwise sit with affected data item.The ideal scenario is I can present a dialog that shows all validation issues that prevent save and I style them based on which are “warnings but save allowed” and which are “error blocks save”. A flag against each validation rule would allow me to do this in a nice generic way that’s simple to maintain across survey definitions.I’ve no problem adding code to customise the save process but need guidance as to whether it’s possible I can add an extension to the validation myself to make such a property valid.I know how to define custom properties against survey/panel/questions but not sure how to do something against a validation attached to a question.On 22 Nov 2024, at 19:34, Andrew @.***> wrote: @digiscapeuk Could you please describe your scenario in more detail? It would be better to be more specific, for example, stating that question 1 depends on question 2. If the value in question 2 is X, then question 1 should have a value like... There are many options available, and I believe you can create a good UI using a combination of existing options along with some coding. Here are some statements:
You can store the survey results (survey.data) at any time you want. You can mark additional options in your survey response as completed/valid, incomplete/invalid, and so on. You have the flexibility to set survey.data or any question value at any point from your code. You can display errors when a question value changes, when navigating to the next page (default behavior), when completing the survey, or you can choose to ignore errors altogether. You can implement additional code that, upon "completing" the survey, will present your UI where you can propose to save it as is or make corrections. If a user chooses to correct their answers, you can either show the entire survey with the first problematic question or create a survey containing only the problematic questions. You can utilize requiredIf and expression validators, as I suggested, to show errors based on the values of other fields. You can add/remove/modify questions errors in the code, based on your logic.
There are numerous options available. Thank you, Andrew
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
Approaching it from another angle - a question may have multiple validation rules. All appear in red with default styles.I may want to indicate that the rules have different types eg some validation rules are specific to a particular external requirement so those ones highlight in another colour or custom icon.If I could attach an optional class list to specific validation rules I could both style the validation rulesets in different ways and also handle the case of allowing save if only non mandatory validation rules are broken.On 22 Nov 2024, at 19:34, Andrew @.***> wrote: @digiscapeuk Could you please describe your scenario in more detail? It would be better to be more specific, for example, stating that question 1 depends on question 2. If the value in question 2 is X, then question 1 should have a value like... There are many options available, and I believe you can create a good UI using a combination of existing options along with some coding. Here are some statements:
You can store the survey results (survey.data) at any time you want. You can mark additional options in your survey response as completed/valid, incomplete/invalid, and so on. You have the flexibility to set survey.data or any question value at any point from your code. You can display errors when a question value changes, when navigating to the next page (default behavior), when completing the survey, or you can choose to ignore errors altogether. You can implement additional code that, upon "completing" the survey, will present your UI where you can propose to save it as is or make corrections. If a user chooses to correct their answers, you can either show the entire survey with the first problematic question or create a survey containing only the problematic questions. You can utilize requiredIf and expression validators, as I suggested, to show errors based on the values of other fields. You can add/remove/modify questions errors in the code, based on your logic.
There are numerous options available. Thank you, Andrew
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
@digiscapeuk The problem I have with your suggestion is that I’m not sure it is a good UI solution. Your goal is to bring your users' attention to a potential issue. An error that doesn't require any action will not be very helpful; a user will only see it if there is another error associated with the same question. Otherwise, it will likely be ignored and not seen by the user at all. It could be noticed if all of these are true:
I would propose a better UI solution where the user is required to take action.
Thank you, Andrew
No problem with it validating on change and showing the alert to the user as they ran through. In fact, that’s how I’ve done this previously.They can see the issue but for those validations marked as warning only they should still be able to step through the form and submit it - at which point I’d do a custom dialog to display what’s wrong and let them choose whether to save anyway. If there’s a method by which I can add a class to the validation rules I can tackle it myself with some custom code.I agree with your point about forcing the user to take action being preferred but there are real world cases where blocking a user from saving changes is not appropriate but removing the validation is not the right move.I guess the other option is to just optionally have the save progress button visible on forms that should allow validations to be ignored. The downside is that would then mean critical validations are also ignored.On 24 Nov 2024, at 11:04, Andrew @.***> wrote: @digiscapeuk The problem I have with your suggestion is that I’m not sure it is a good UI solution. Your goal is to bring your users' attention to a potential issue. An error that doesn't require any action will not be very helpful; a user will only see it if there is another error associated with the same question. Otherwise, it will likely be ignored and not seen by the user at all. It could be noticed if all of these are true:
The question is not the last one on the page. Error validation mode is set to "on value changed" The question title remains visible when moving to the next question.
I would propose a better UI solution where the user is required to take action. Thank you, Andrew
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
@digiscapeuk Could you please provide a small part of your survey/form that illustrates the problem? It would be better to discuss the issue based on a real case in order to find the best UI solution. We will be able to create a small example using the actual JSON.
Thank you, Andrew
Is your feature request related to a problem? Please describe. There are cases where it's desirable to define validations on an item to show a warning message but the user should not be blocked from saving the survey.
Describe the solution you'd like Validations have an additional property to "allow save". When these validations trigger they appear on screen & the user can be prompted on survey submit with configurable text e.g. "This survey has the following validation warnings: {list}. Press Ok to Save or Cancel to amend the survey".
Describe alternatives you've considered Custom expression items that use visibility rules to show/hide them and custom code on save.