Closed (fixed)
Project:
Skip Validation
Version:
6.x-1.3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Oct 2009 at 03:12 UTC
Updated:
27 Oct 2009 at 04:30 UTC
Hello,
I have downloaded this module, because I needed users to be able to Save unpublished content without having to fill out all the required fields. So, I used the Save & edit module and used the Skip validation module in the buttons Save and edit, but not in the Publish.
The problem is that when the user submit the node using the Save and edit button (which skips validation), I get the message: "warning: mysqli_real_escape_string() expects parameter 2 to be string" and the content is not saved at all.
I have tried to make some fields not required, but the error won't go away. Any ideas of how this could be solved?
Thank you in advance,
Daniela
Comments
Comment #1
cdale commentedWhile skip validation will work quite well for delete actions, it will most likely not work for save actions. This is because skip validation actually prevents all validation routines from being run.
This will break modules and fields that rely on validate callbacks to adjust form values.
While this is something that I'd like to support, it would be quite difficult in the current framework. I will see what I can come up with, but I can't make any guarantees or promises that I'll be able to make it work.
Comment #2
cdale commentedOk. I actually had a think about this, and I believe I've solved this issue with the latest commit.
The API now has three FAPI options for buttons.
#skip_validation - Skips all validations, core (#required, #maxlength, and #options checking), and all #element_validate and #validate callbacks.
#skip_core_validation - Skips only the #required, $maxlength and #options checking.
#skip_required_validation - Skips only the #required validations.
So for your problem, if you download the release I'm about to create, and instead of using #skip_validation, I'd recommend using #skip_required_validation. This should solve *Some* of your problems. I won't be able to guarantee the sanctity of your data by doing this. Module maintainers typically make fields required for a reason.
Whilst there are use cases for this, it is very black and white. This module does not allow you choose some fields to be skipped, and others not. Use with care.