I have a field "BRD Supplement Link" defined as "HyperLink" in my SharePoint list.
The issue is that if it is required i see an error.
When it is optional i do not see an error message- how can i make the error message pop-up even if it is not a mandatory field.
Please see what i have at the moment at the visible property of ERROR CONTROL
Also, the Parent card's required property is dependent on a toggle field and the formula for that is - DataCardValue40_3.Value
Solved! Go to Solution.
I think I'm following...
So, change the Required property of the DataCard to:
DataCardValue40_3.Value || !IsBlank(DataCardValue45_3.Text)
Set the Update Property to the following:
If(!IsBlank(DataCardValue45_3.Text) && !("https://***BRD***" in DataCardValue45_3.Text) && Parent.Required, Blank(), DataCardValue45_3.Text)
Let's see if that hits the mark!
If you want that to appear in all cases, then you can just take the !Parent.Valid out of the formula.
I hope this is helpful for you.
@RandyHayes I thought so too- unfortunately that did not work.
Now my formula looks like
And now, if i try to put any random value (not link) in the hyperlink field- it lets me input it and save the form- but doesn't show the value in data source. It did not even show the error or stop me from saving the form if it doesn't consider it as a hyperlink. It just lets me save, discards my inputted value and i see a blank. See Gif below
Yes...If I recall correctly, we put the formula in the Update property of that datacard to trick the validation. If the entry did not contain "//" in it, I believe it is setting to Blank. This is what caused the Valid property to become false because it was required (based on the toggle).
SO, if you want to store whatever is in the entry, then change the Update property and remove the logic to "invalidate" the datacard.
@RandyHayes That's god-level memory. I forgot that Randy.
Now, we want the file link to be coming from a particular library within our SP and hence this formula in UPDATE property
I want to retain this logic, how do i invalidate the field to show the error message whenever somebody is putting any other link that does not contain this?
I believe you want to validate only if it needs to be validated, otherwise just pass through whatever is in that input.
So, change the formula in the Update to:
If( !("htt.....cedocs" in DataCardValue45_3.Text) && Parent.Required, "", DataCardValue45_3.Text)
That should give you the "required" logic when it is required, otherwise just save when something is not required.
@RandyHayes I want to validate it without it being mandatory. Is it possible?
I know erasing the data to say blank if it does not meet our code is right too, but am afraid some users will say- we saved it- you never showed an error that it was invalid. I don't want to reason that the field wasn't mandatory and hence can't show the error. Is there a way to show irrespective if it's an error or not?
I found the way last time- but it was always showing error, i wanted it to show error only when we hit "Save"
I guess I'm a little lost on the concept though. Consider this:
If the user enters an invalid value and it is not required (i.e. the toggle is not on) and they fill everything else out on the tabs properly and then Save...when would they ever see the error? It would consider the value not required and would just pass the value entered in.
So, that is based on the concept that you only wanted the error to show if they hit save, and again, if everything is completed otherwise, they would save and exit and never see an error.
Is this perhaps where you're going with this:
Always show the error message regardless of clicking save if the value entered is invalid and if it is required, make it fail there and need to be corrected before saving, otherwise save it (noting that the user will NOT be required to change the value if it is not required and will be able to save an invalid value).
Please excuse if i have confused you- i'll try briefing again:-
I prefer to show the error on this non-required field only when i hit save.
I managed to bring up the error without requiring user to hit save but that's not a consistent experience for user. I would want to show only when i hit save and not when he is midway filling the form. This is because all others show error only when a form is being saved and it fails. I know that is because they are mandatory fields and this one is not... is there a ways to pop-up the error on non-required field only on SAVE button's failure?
So again, the issue is that if they hit Save and it is not mandatory and all the rest of the form is complete, then there will be no failure from a validation standpoint and thus it will save.
I could only think that you would need to introduce lclOneShot into the required property as well as the toggle check. That would make the datacard always required until save is hit (this will allow the form to be Valid or not).
Then you could essentially make the form invalid if the value is incorrect. Then, based on the lclOneShot determine if you can actually save it.
So (and apologies that I don't recall all the control names properly) in the Required property of the datacard:
ToggleControl.Value || !lclOneShot
and in the Update property:
If( !("htt.....cedocs" in DataCardValue45_3.Text) && (Parent.Required || !lclOneShot), "", DataCardValue45_3.Text)
This would cause the Update property to be blank if it does not meet the in operator and if it is required or not oneshotted. So, here are the scenarios:
|Save never pressed||True||True||False||True||Nothing Shown|
|Save Pressed||True||True||True||True||Form Saved (nothing shown)|
|Save never pressed||True||False||False||True||Nothing Shown|
|Save Pressed||True||False||True||False||Form Saved (nothing shown)|
|Save Never Pressed||False||True||False||True||Nothing Shown|
|Save Pressed||False||True||True||True||Error Shown, Nothing Saved|
|Save Pressed Again||False||True||True||True||Error Shown, Nothing Saved|
|Save Never Pressed||False||False||False||True||Nothing Shown|
|Save Pressed||False||False||True||False||Error Shown, Nothing Saved|
|Save Pressed Again||False||False||True||False||Form Saved|
The last one in Red is the one you are looking for.
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.