autocomplete="off" option?

Support MB Frontend Submission autocomplete="off" option?Resolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32886
    Stephen C.Stephen C.
    Participant

    Is there any option to set autocomplete="off" for the entire form or individual fields? I need to prevent the browser from filling in fields with cached values instead of previously saved values if the user refreshes the page. I know it can be done via Javascript, but setting it in the form's HTML would be better.

    #32892
    Long NguyenLong Nguyen
    Moderator

    Hi Stephen,

    Currently, we do not support an option or a filter hook to modify the form HTML. You can use the JavaScript code to add more attributes to the form.

    #33025
    Stephen C.Stephen C.
    Participant

    Unfortunately, using Javascript doesn't seem to work, because the browser fills in the form fields before the Javascript is run.

    In case anyone else needs to do this, the solution is to add a hidden field with the id "autocomplete" and value "off" as the first field on the form. It has to be the first form field, though. You will also want to add 'save_field' => 'false' to prevent the field from being saved in the database.

    #33026
    Stephen C.Stephen C.
    Participant

    Nope, scratch that. I thought it was working, but it doesn't because the first form field is a hidden field created by Meta Box. There's no way to add a field before it.

    I guess I'll have to edit the Meta Box source code (Form.php) and just remember to edit it every time I update Meta Box (or just not update Meta Box unless it's a critical update). That seems to be the only way to prevent the browser from filling in form values with cached data.

    #33028
    Stephen C.Stephen C.
    Participant

    I should say, "edit the Meta Box Frontend Submission source code", not the core Meta Box source code.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.