• Resolved msteel

    (@msteelnapcocom)


    Is there a way to do front end validation, hopefully with jQuery validate. I see there is some JS validation in the plugin, but it does not seem to work for me, even on a clean install of WP and Pods.

    I need to prevent the custom post type from saving if the required fields are not valid.

    Any help would be appreciated, thanks.

    https://wordpress.org/plugins/pods/

Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter msteel

    (@msteelnapcocom)

    Has anyone had a chance to try this plugin?

    Thanks,

    -M

    Plugin Contributor Josh Pollock

    (@shelob9)

    Sorry, I did not get a chance to try this yet. Can you please provide some information on how it works? Do I need to define what my validation conditions are for my fields?

    Thread Starter msteel

    (@msteelnapcocom)

    You do not need to define anything. I have gotten all fields to validate simply by enabling the plugin.

    When the form is submitted an ajax request is fired submitting the form fields. Any form fields that belong to the pod are validated in one of two ways. If a field is required and has a blank value it is flagged and the form field is highlighted. If somehow that does not suffice it passes off to the Pods API handle_field_validation method.

    Any field that was flagged will be updated upon change and re-validation.

    When there are no errors the form process continues.

    Plugin Contributor Josh Pollock

    (@shelob9)

    It seams to work well for front-end forms. Very cool.

    Two important things I saw:
    1) You should move everything into the root level of the GitHub repo, that way it can be installed directly from the download or a Git clone.
    2) This is running both in front-end and back-end. It prevented me from publishing a post. I would recommend only running this in the front-end. You can probably just wrap the action in !is_admin() to fix that.

    Also, I was thinking a cool enhancement once you have your first version down would be to allow users to add additional conditions and warning messages on a per field basis.

    Thread Starter msteel

    (@msteelnapcocom)

    Thanks for the reply, I updated Git.

    As for front-end/back-end, I wanted this to validate on the admin side, but have the validation happen in the browser, before the user receives a wp_die.

    I initially thought about making it jQuery Validation oriented, but I really wanted to bring the Pods validation to the front so that our users wouldn’t be endlessly hitting Back to fix another field on a form.

    And as for the Pods validation, this question has been killing me.. is it ever possible to trigger some of the basic validation such as on the text and email fields.

    This never worked for me…
    if ( 0 < strlen( $value ) && strlen( $check ) < 1 ) {

    I had to try (and this was a couple of weeks ago, so I think…
    if ( ! strlen( $value ) && strlen( $check ) < 1 ) {

    I think I kept the $check in from the pre save.

    Thread Starter msteel

    (@msteelnapcocom)

    Any chance for an answer to my last question? Thanks.

    Hi

    I tried it, it have a big issue. When I Activate it, the Publish button on all the Posts and Pages stop working. To publish a post I should use Quick Edit! My Installation is:

    • Windows 8.1
    • WAMP 2.5

    Thanks

Viewing 7 replies - 16 through 22 (of 22 total)

The topic ‘Front end validation`’ is closed to new replies.