getgrav / grav-plugin-form

Grav Form Plugin
http://getgrav.org
MIT License
53 stars 79 forks source link

[4.0] Buttons not rendered #368

Open mikebi42 opened 5 years ago

mikebi42 commented 5 years ago

image Same file works fine in form 3.0.7 but not 4.0.0-rc.1 image Interesting that the button html seems to be surrounded by quotes.

withindale commented 5 years ago

Same problem and please note the validation text is displayed as shown in the code blocks.

Contact TEST Form
*Required field
Name *
"Enter your name"
Email *
"Enter your email address"
<button type="submit" class="button " >Submit</button> <button type="reset" class="button " >Reset</button>

This test has fields copied from readme.md.

Our full contact form was also falling over on reCaptcha on our development site before the update to 4.0. That's why we have not updated our live site from Grav v1.6.9 - Admin v1.9.4.

Here is an example:

Contact Form
Required field
Subject *
Message *
Name *
Company *
Email *
Phone
Captcha *
<script> var captchaOnloadCallback_contact = function captchaOnloadCallback_contact() { grecaptcha.render('g-recaptcha-contact', { 'sitekey': "6LF....", 'callback': captchaValidatedCallback_contact, 'expired-callback': captchaExpiredCallback_contact }); }; var captchaValidatedCallback_contact = function captchaValidatedCallback_contact() {}; var captchaExpiredCallback_contact = function captchaExpiredCallback_contact() { grecaptcha.reset(); }; </script> <script src="https://www.google.com/recaptcha/api.js?onload=captchaOnloadCallback_contact&render=explicit&hl=&theme=light " async defer></script> <div class="g-recaptcha" id="g-recaptcha-contact"></div>
<button type="submit" class="button " >Send</button> <button type="reset" class="button " >Reset</button>

If it helps as a clue, a text field in a form with only one field did not show the validation text but the buttons did not display.

rhukster commented 5 years ago

@khanmicro @withindale can you provide me with the page frontmatter that you use to define the form?

mikebi42 commented 5 years ago

https://learn.getgrav.org/16/forms/forms/example-form

Just used example, and simplified to just display message on submit. Also named it form.md

Sorry not at my computer right now.

rhukster commented 5 years ago

OK, I think I must have fixed this already just not released... It works fine for me with latest form 4.0 branch. Can you please test?

monosnap-2019-08-27-11-01-48 image
mikebi42 commented 5 years ago

Downloaded the latest dev build from git hub, looks good. I would vote to make another development release so people can easily update.

rhukster commented 5 years ago

Thanks, i'll get a new release out shortly.

withindale commented 5 years ago

Still a problem here with the new release, sorry to say.

grav-en-grav_1_7_0-beta-5-admin_1_10_0-beta5

Above with Grav v1.7.0 beta 5, Admin v1.10.0 beta 5, Form v4.0.0-rc.3.

contact-supra-skeleton-grav-1_6_15-admin-1_9_9

Same form with Grav v1.6.15 - Admin v1.9.9, Form v3.0.8

`title: 'Contact SUPRA Form'
form:
    fields:
        name:
            type: text
            label: Name
            validate:
                required: true
                message: 'Please enter your name!'
        email:
            type: text
            label: Email
            validate:
                type: email
                required: true
                message: 'Please enter your email address!'
        subject:
            type: text
            label: Subject
            validate:
                required: true
                message: 'Please enter a subject for your message!'
        message:
            type: textarea
            label: Message
            validate:
                required: true
                min: 10
                message: 'Email message needs to be more than 10 characters long!'
    buttons:
        submit:
            type: submit
            value: 'Send Email'
    process:
        email:
            from: '{{ form.value.email }}'
            to: '{{ config.plugins.email.to }}'
            subject: '[Contact] {{ form.value.subject|raw }}'
            body: '{{ form.value.message }}<br /><br />{{ form.value.name }}<br />{{ form.value.email }}'
        message: 'Thank you from contacting us!'
        display: /form/thankyou`
rhukster commented 5 years ago

Can you send me a zip of you beta test site? I can’t replicate this.

withindale commented 5 years ago

Yes, Let me see if the problem persists if I strip out the non-essentials first.

withindale commented 5 years ago

I have emailed a download link for the stripped down version to contact@getgrav.org. For behavior see https://www.codeway.biz/grav-form/contact-test.

rhukster commented 5 years ago

OK thanks for that @withindale. The issues were quite specific to Gantry because it disables auto-escaping by default. I think I have these sorted and committed to the 4.0 branch. Can you clone/download the latest version of this branch and replace your form plugin with it to test?

withindale commented 5 years ago

Many thanks @rhukster. Now working after replacing the modified files in the form plugin.