Create an xml field and set the shownon attribute to whatever is the value of another field then set the attribute to "required=true". You'll get an error while saving that it cannot be saved because a required data is missing or something like that.
Shouldn't it check for "shownon"? If set and not enabled, bypass the field required validation and if enabled then it validate for required value?
The validation of required field does not check the field showon attribute value.
I don't know if this is a bug, but looking at it as in an end user perspective it is a bug. First thing that comes to my minds is "That field is not enabled, why do I have to enter a value?" .
Labels |
Added:
No Code Attached Yet
|
As of right now, shownon is only used to UI to show/hide fields depends on certain conditions. We do not use it for validating submit form data. Through the years, I have seen several reports like this but we never work on it further.
For the time being, I guess you will have to use default value as suggested by @chmst as a workaround. I'm converting this to discussion to see if we want to work further on it.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-11-13 10:47:36 |
Closed_By | ⇒ | joomdonation |
You can define a default value for this field, which is used if the field is not visible on the screen.
I don't remember if ther are reasons for this - but looks like a valid request for me.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37454.