Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two Forms on One Page Showing Server 500 Error When Second One Submitted #2072

Closed
twd3 opened this issue Jul 12, 2020 · 9 comments
Closed

Two Forms on One Page Showing Server 500 Error When Second One Submitted #2072

twd3 opened this issue Jul 12, 2020 · 9 comments

Comments

@twd3
Copy link

twd3 commented Jul 12, 2020

I have two forms on one page...well one shows large and up and one shows medium screens and down. I'm having an issue where one of the forms works (large screen if it matters) and the other doesn't. I made sure all form handles are unique so I know it isn't an ID or input name issue.

How to Reproduce

Put two forms on one page with simple required validation on both. One will work, the other won't.

I have this live if you want to look for yourself DM me for the link.

Statamic version: 3.0.0.-beta-37

PHP version: 7.3

Install method:

  • Fresh install from statamic/statamic
@jasonvarga
Copy link
Member

Are you using different form:set tags?

@twd3
Copy link
Author

twd3 commented Jul 12, 2020

Yes

@jasonvarga
Copy link
Member

Let’s see the template

@twd3
Copy link
Author

twd3 commented Jul 12, 2020

This?

{{ form:set is="quick_contact_sm" }}
{{ form:create redirect="/thank-you-for-contacting-us" id="ahQuickFormSm" autocomplete="off" }}
	
{{ if {form:errors} }}
<div class="flex">
  <div class="w-full p-1 mb-2 bg-white rounded">
      <p class="m-0 text-ah_red"><i class="fas fa-ambulance text-ah_red"></i> Please check the errors below...</p>
		<div class="hidden">{{ form:errors }}{{ value }}{{ /form:errors }}</div>
  </div>
</div>
{{ /if }}

<input id="first_name_sm" name="first_name_sm" type="text" placeholder="First Name" class="validate txt-q-input placeholder-gray-300" value="{{ old:first_name_sm }}">
{{ error:first_name_sm ensure_left="*" wrap="span.error" }}
<input id="last_name_sm" name="last_name_sm" type="text" placeholder="Last Name" class="validate txt-q-input placeholder-gray-300" value="{{ old:last_name_sm }}">
{{ error:last_name_sm ensure_left="*" wrap="span.error" }}
<input id="email_sm" name="email_sm" type="email" placeholder="Email Address" class="validate txt-q-input placeholder-gray-300" value="{{ old:email_sm }}">
{{ error:email_sm ensure_left="*" wrap="span.error" }}
<input id="phone_sm" name="phone_sm" type="text" placeholder="Phone Number" class="validate txt-q-input placeholder-gray-300" value="{{ old:phone_sm }}">
{{ error:phone_sm ensure_left="*" wrap="span.error" }}
	
<textarea id="q_message_sm" name="q_message_sm" placeholder="Your Message" class="validate txt-q-input placeholder-gray-300">{{ old:q_message_sm }}</textarea>
{{ error:q_message_sm ensure_left="*" wrap="span.error" }}

<input class="hidden" id="fu-bots-sm" name="fu-bots-sm" type="text">
<input class="hidden" id="came_from_sm" name="came_from_sm" type="text" value="FULL SITE">
<button id="ahQuickSubmitSm" type="submit" class="inline-flex justify-center items-center mt-4 xl:mt-8 text-white btn btn-large btn-expanded btn-white-border btn-shadow-medium">GET EVALUATION</button>  
{{ /form:create }}
{{ /form:set }}

@twd3
Copy link
Author

twd3 commented Jul 12, 2020

Here is the Other:

{{ form:set is="quick_contact" }}
{{ form:create redirect="/thank-you-for-contacting" id="ahQuickFormR" autocomplete="off" }}
	
{{ if {form:errors} }}
<div class="flex">
  <div class="w-full p-1 mb-2 bg-white rounded">
      <p class="m-0 text-ah_red"><i class="fas fa-ambulance text-ah_red"></i> Please check the errors below...</p>
		<div class="hidden">{{ form:errors }}{{ value }}{{ /form:errors }}</div>
  </div>
</div>
{{ /if }}

<input id="first_name" name="first_name" type="text" placeholder="First Name" class="validate txt-q-input placeholder-gray-300" value="{{ old:first_name }}" autofocus>
{{ error:first_name ensure_left="*" wrap="span.error" }}
<input id="last_name" name="last_name" type="text" placeholder="Last Name" class="validate txt-q-input placeholder-gray-300" value="{{ old:last_name }}">
{{ error:last_name ensure_left="*" wrap="span.error" }}
<input id="email" name="email" type="email" placeholder="Email Address" class="validate txt-q-input placeholder-gray-300" value="{{ old:email }}">
{{ error:email ensure_left="*" wrap="span.error" }}
<input id="phone" name="phone" type="text" placeholder="Phone Number" class="validate txt-q-input placeholder-gray-300" value="{{ old:phone }}">
{{ error:phone ensure_left="*" wrap="span.error" }}
	
<textarea id="q_message" name="q_message" placeholder="Your Message" class="validate txt-q-input{{ if errors }} eval-tarea-height-error{{ else }} eval-tarea-height{{ /if }} placeholder-gray-300">{{ old:q_message }}</textarea>
{{ error:q_message ensure_left="*" wrap="span.error" }}

<input class="hidden" id="fu-bots" name="fu-bots" type="text">
<input class="hidden" id="came_from" name="came_from" type="text" value="FULL SITE">
<button id="ahQuickSubmitR" type="submit" class="inline-flex justify-center items-center mt-4 xl:mt-8 text-white btn btn-large btn-expanded btn-white-border btn-shadow-medium">GET EVALUATION</button>  

{{ /form:create }}
{{ /form:set }}

@twd3
Copy link
Author

twd3 commented Jul 13, 2020

I get server error 500 when trying to submit that template on top. Below is the log I got from Forge. I checked and all email addressesare configured and formatted properly? Or is this because my email handle on form not working is email_sm and needs to be email?

[2020-07-13 23:45:49] local.ERROR: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. {"exception":"[object] (Swift_RfcComplianceException(code: 0): Address in mailbox given [] does not comply with RFC 2822, 3.6.2. at /home/forge/www.domain.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:355)

@twd3 twd3 changed the title Two Forms on One Page Validation on One Triggers the Other Two Forms on One Page Showing Server 500 Error Jul 13, 2020
@twd3 twd3 changed the title Two Forms on One Page Showing Server 500 Error Two Forms on One Page Showing Server 500 Error When Second One Submitted Jul 13, 2020
@duncanmcclean
Copy link
Member

I get server error 500 when trying to submit that template on top. Below is the log I got from Forge. I checked and all email addressesare configured and formatted properly? Or is this because my email handle on form not working is email_sm and needs to be email?

[2020-07-13 23:45:49] local.ERROR: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. {"exception":"[object] (Swift_RfcComplianceException(code: 0): Address in mailbox given [] does not comply with RFC 2822, 3.6.2. at /home/forge/www.domain.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:355)

That error there looks like an issue with Statamic trying to send an email. Make sure to configure your mail settings in your .env and try again.

(If you're in local development, use the log mail driver and the emails will be sent to your log file.)

@twd3
Copy link
Author

twd3 commented Jul 14, 2020

Thanks, but I know the config in my servers .env is right because it's been working. It only gives me this error when two are on one page. The config is just mailgun. So are you saying you have two forms on one page (not just a login form) working?

@twd3
Copy link
Author

twd3 commented Jul 17, 2020

100% my fault so sorry, closing now.

@twd3 twd3 closed this as completed Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants