Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Yes, I think that’s already been fixed in the dev version (download it from the “other versions” area of the plugin page). See the bug-tracker for info on the bug, including the SVN revision number of when it was fixed.

    Thread Starter mbi_marc

    (@mbi_marc)

    Sorry for re-opening this, but I’m having difficulty finding the bug in the bug tracker, and the newest version released today doesn’t seem to include a fix for this. I’m wary of using the dev version because, well, it’s a dev version.

    The closest thing I can find in the bug tracker is issue #374, which is related but not quite the same. As per that issue, a value of 000000 is correctly allowed (and this does work for me), but a value of simply a single 0 is still not working for me.

    I’m not able to set this field to a number, as the value can either be numeric or a descriptive string (such as “variable”) depending on the specific item.

    Have I missed the correct issue in the tracker?

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    0 evaluates to empty, so if the field is required, it needs a non-zero value.

    Thread Starter mbi_marc

    (@mbi_marc)

    0 evaluates to empty, but there are ways of differentiating a string ‘0’ from empty if you try (such as an === comparison, or using isset() ). Is the issue that the code doesn’t take the field type into account at all when checking for a value? Shouldn’t text and textarea fields be tested against as a string?

    As a separate question, if I were to try to fix this myself, is function get_value() in includes/CCTM_FormElement.php the correct place to do it? I’m not familiar with your code at all, so having a starting point would save me a ton of time!

    Thanks in advance.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    You’re welcome to look through the code — it’s well-commented and the bug tracker lists exactly where this issue was. This problem is really difficult because the value is going through POST and through json encoding, so it is always set (i.e. isset is useless), and values are always typed as strings (so === is useless). So really what you’re asking for is that “required” fields must contain ANY non-whitespace value, i.e. a strlen > 0, but I’m not sure that’s the correct solution.

    Thread Starter mbi_marc

    (@mbi_marc)

    I’m not sure that this holds up as well for other field types, but specifically for text/textarea, I’m not sure what else required would mean, if you’ve given no validation rule.

    Did they type something in? Yes.
    Does it match the rule of <absolutely no rules at all>? Yes.
    Validation passed!

    If there weren’t a validation rule option, this would be less clear cut, but there is, so…

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    I’ve reopened the ticket.

    I’m having the same problem. Trying to save a record with ‘0’ as a value will not give any error messages for me, but it will force the post into draft status.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Please refer to the latest version of the plugin. Version 0.9.7.3 was released a couple hours ago. The forums are a difficult place to discuss stuff like this because there’s no accountability and there’s a lack of details like the specific version number. If you have downloaded the latest version and you still are having this problem, then please file a bug in the bug tracker: it taxes my sanity trying to shepherd random forum comments into bug reports or feature requests.

    This was immediately after upgrading to 0.9.7.3. Sorry, I didn’t know there was a bug tracker. I’ll try to find it.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    There’s a bug tracker and a wiki, both conspicuously linked on the plugin’s homepage and from the WP manager on any CCTM page.

    Thread Starter mbi_marc

    (@mbi_marc)

    I’m seeing the same thing- no more error messages, but still can’t publish it. I don’t see a new bug posted by vanadum322, so I made a comment on issue 374 (the one previously used for this). If you’d prefer I post a new one, I can do that- just not sure of normal protocol here.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    See the bug tracker. I”m losing my mind switching between the forums and the bug tracker: https://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=374

    Works perfectly since last update ( 0.9.7.5-pl )
    thanks !

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Value of 0 in a required text field’ is closed to new replies.