WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields: Validated Field
[resolved] Undefined index message (6 posts)

  1. aboother
    Member
    Posted 2 months ago #

    Hi,

    I have just updated to version 1.2.1 of the plugin. It works great except I get the following two messages at the top of each page:

    Notice: Undefined index: version in /Users/adamboother/workspace/isis/src/wp-content/plugins/validated-field-for-acf/validated_field_v4.php on line 683

    Notice: Undefined index: version in /Users/adamboother/workspace/isis/src/wp-content/plugins/validated-field-for-acf/validated_field_v4.php on line 684

    I have also noticed my custom message does not show in the red bubble which appears when you fail validation. E.g. I have the following validation:

    <?php
    if(strlen($value) < 10) {
        $message = "Test alert";
        return false;
    } else {
         return true;
    }

    but my custom message of 'Test alert' does not show when I enter less than 10 characters in the field, instead I just get an empty small red bubble.

    Cheers.

    https://wordpress.org/plugins/validated-field-for-acf/

  2. doublesharp
    Member
    Plugin Author

    Posted 2 months ago #

    @aboother Version 1.2.2 fixes the alerts that you were seeing - it should now be properly associating the plugin version with the javascript includes.

    Since you are getting lots of PHP notices, my guess is that something similar is messing up the JavaScript. After you update, can you use the developer tools in Chrome to get the request/response for the AJAX? This will work best if you set ACF_VF_DEBUG to true in wp-config.php so that it doesn't use the minified version of the javascript and will ask you if you want to submit the form on success.

    define( 'ACF_VF_DEBUG', true );
  3. aboother
    Member
    Posted 2 months ago #

    @doublesharp please find that info below:

    Form data:

    action=validate_fields&post_id=494&click_id=publish&fields%5B0%5D%5Bid%5D=fields%5Bfield_536226330aa1f%5D&fields%5B0%5D%5Bvalue%5D=test&fields%5B0%5D%5Bvalid%5D=false

    Response:

    <b>Notice</b>: Unefined offset: 3 in <b>.../validated_field_v4.php</b> on line <b>142</b>
    [{id:fields[field_536226330aa1f], message:Test alert, valid:false}]

    0: {id:fields[field_536226330aa1f], message:Test alert, valid:false}
    id: "fields[field_536226330aa1f]"
    message: "Test alert"
    valid: false

    The PHP errors have now gone, but I still don't get my custom validation message showing in the red bubble which I assume is down to these errors above?

    Cheers.

  4. doublesharp
    Member
    Plugin Author

    Posted 2 months ago #

    @aboother - That is indeed the issue. Not sure why my system isn't reporting the warnings/notices like yours, but I think I got them all in version 1.2.4. If you are still having issues with that version send me a note and I'll have you try a beta version before pushing it out to everyone. Thanks!

  5. doublesharp
    Member
    Plugin Author

    Posted 2 months ago #

    Errr... I mean version 1.2.5.1. Creating version tags does not always go as expected. Sigh.

  6. aboother
    Member
    Posted 2 months ago #

    @doublesharp - I can imagine that is the case with version tags!

    You'll be glad to hear that all works a treat now, thanks very much.

Reply

You must log in to post.

About this Plugin

About this Topic