Cannot pass zero through ajax #379
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#379
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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
Make new ajax input in "PHP Ajax Methods *" section.
Send zero value in javascript code.
Expected result
success
Actual result
false
System information (as much as possible)
Additional comments
JCB uses this construction to check the data:
It will always return false if we pass a zero value in any variable.
The only way to solve it, i believe, is sending an array, but why not checking
empty($variable)
instead of just$variable
?Seeing that is an issue, we normally catch the zero values in the model directly from the
JFactory::getApplication()->input
opject. This means that if you need to work with a zero value, do not add that value as part of the controller catch and sanitation, but get it in the model (your code)saveCat
.I can see the need to change this, so I will add a tag to enhance JCB to not sanitize (if so desired by the developer) the values, but leave it to the model. Let me see how easy that would be, and get back to you. Until then the above is a great work around.
You can now pass zero and even null values to the model by this new checkbox called
Allow null & zero values
: