Open teichsta opened 2 years ago
In theory this plugin should behave exactly like the when
property of standard Kirby, since it overrides the function that when
uses (the meetsCondition
function). It doesn't actually actively "hide" sections and fields, it just answers the question whether a field should be hidden or not. That's why I find it really strange that it behaves differently from the normal when
.
Could you provide an example blueprint?
Hi, I do have the same problem with required fields when they are hidden. Here is a simplified example:
category:
type: checkboxes
options:
value1: Value 1
value2: Value 2
firstTitle:
type: text
required: true
whenQuery: category ::any($ = "value1")
secondTitle:
type: text
required: true
whenQuery: category ::any($ = "value2")
If I only select value1
in the category fields, I still have an alert if secondTitle
(that is hidden) is empty.
does this example help @rasteiner ?
Yes, sorry. I was swallowed by deadlines. It seems like kirby also checks on the serverside if a field is required or not.
This makes it much more difficult, because the query can currently only be evaluated in the browser. Also, I don't believe I can change the serverside code in any way from a plugin.
So, currently I have no idea how I could fix this.
I have the same issue using kirby v4.
Unfortunately the situation in Kirby 4 has not changed. There is no reasonable way to extend this behaviour in Kirby. Even if I'd implement the query parser in server side code, there is no way I could make Kirby use it.
The only solution would be to integrate this functionality into Kirby core; I already asked the team about this and there doesn't seem to be much interest in accepting such a pull request.
Hi,
thanks for providing this great plugin! I am wondering if there is a way to deal with required fields like in kirby itself. If a required field is hidden a page is considered "valid". While whenQuery doesn't seem to take this into account. Even hidden fields are evaluated while changing the pages state, correct?
Is there a way around it?
Best, Thomas E.-E.