[BUG?] Q&A: unable to save the AllCategories (SD) dynamicGet #494
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#494
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Steps to reproduce the issue
Open AllCategories (SD) dynamicGet from Q&A component
Try to save it without any change
Expected result
Element saved
Actual result
It requires the "state key" field to be set
System information (as much as possible)
Additional comments
My question is: if I'm not able to save your example component without any change, how it has been made? And, more important, how can I replicate it?
Okay so at some point in the history of Joomla the sub-form field type did not support required fields. It was during this time that that dynamicGet was made. Since then things have been improved, and now sub-forms do support required fields.
As you can see I also now get the same error as you do.
When we look at the code in the compiler where that state is being used it does not require you to add the
state_key
since it defaults to the$this->levels
that are dynamicly set in each model.That is why it worked in the past even with the value empty. Now we have two options, one you just add
$this->levels
to be able to save the dynamicGet, and being able to use the access levels filter. But really since it is not used you can add anything as it will be dumped. The other option is that I with the next release remove thestate_key
from being required, this you can also do by opening /admin/models/forms/dynamic_get.xml and change the value of the state_key field that is required to false like this:Then you can leave the field blank, but know that with other of the filter options leaving that field blank will also cause unforeseen errors. Like if you look at the Function Var filter option on line 2055 you will see that the state_key is required.
Being able to change the field required based on the filter selection is not that easy at all... so what shall we do, just always force you to add a value making sure that you looked at the compiler and understood the code. I mean if you just took the name
state_key
and search over the compiler code base you will find it only used seven times, and reading the code around it would quickly reveal to you the implementation. Which is what I hope would happen as I think this will empower you to take JCB beyond the basics.But how all this happened, welcome to Joomla! What do you think should I make the field not required or just update the dynamicGet?
First of all thanks for your quick reply.
Now I understand, thanks.
As you already used a lot of Note field to explain things inline (which are really very useful), maybe a Note field to explain it would be enough.
I know that Joomla changes very often and when you have to manage different requirements with the same interface a bit of inline info helps a lot. I mean, even just a “Have a look to the compiler file to check what it is required” message with a link to the compiler file would be very useful. You made JCB and for you it’s “natural” to look into that, but for a user who has a deadline to complete the script it’s not so natural, if you know what I mean. Sometimes, at the of the day, I don’t know my name...
Thanks for your explain!
Have a nice sunday!