Skip to content

Form validation is broken #11

@tombroucke

Description

@tombroucke

HTML Forms' validation is based on the form's post meta. When a form is saved in the WP backend, the required & e-mail fields are serialized & saved to _hf_settings. The required fields are extracted with JS from the #hf-form-editor field, which is populated by the post content.

A possible solution would be to ask the HTML forms plugin creator to add a filter to functions.php:100 return $form;, so we can inject our form code (everything inside the

tag). A small tweak to our sage-html-forms/resources/views/components/html-forms.blade.php is needed, so it is similar the original output:

<form {!! $attributes->merge($form->attributes) !!}>
  <input type="hidden" name="_hf_form_id" value="{{ $form->ID }}" />
  <div style="display: none;">
    <input type="text" name="_hf_h{{ $form->ID }}" value="" />
    {!! $hidden !!}
  </div>
  <div class="hf-fields-wrap">
    {!! $slot !!}
    <noscript>Please enable JavaScript for this form to work.</noscript>
  </div>
</form>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions