Home Forums Backend Issues (wp-admin) Custom button / required fields error message


Custom button / required fields error message

  • hi,
    i created a acf field addon where i get the current geolocation.
    the user clicks a button <button id=”btnFind”>Where am i?</button> which triggers a function (navigator.geolocation.getCurrentPosition) and recieves the current position coordinates. this works fine.

    but i also have other acf fields which are required.

    somehow as soon as i click the “where am i?” button, all the required fields which are not filled, an error message is shown.

    is it possible to click the “where am i?” button without having this issue?


  • never mind, the solution is very simple.
    if you add type=’button’ to the button, the page does not get refreshed

  • Or, in your javascript, make sure the form does not submit

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Custom button / required fields error message’ is closed to new replies.