-
AuthorPosts
-
October 23, 2018 at 3:33 pm #1025465
Hi
Is it possible to add a tag to a contact form so ‘Submit’ sends data using a script added to the page? See form details below.Thanks
StevenWe add the following script:
<script id=”guestline-tag” src=”https://tag.guestline.net/static/js/tag.js” data-groupid=”D_EDINBURGH” async></script>Then require this form:
<form data-guestline-form>
<select name=”hotel-id” placeholder=”Hotel”>
<option name=”hotel” value=””>Any Apartment</option>
<option name=”hotel” value=”DESTYORK”>York</option>
<option name=”hotel” value=”HOTEL2″>Southside</option>
<option name=”hotel” value=”HOTEL3″>Rodney</option>
</select>
<input type=”text” name=”arrival” placeholder=”Arrival” />
<input type=”text” name=”departure” placeholder=”Departure” />
<input type=”number” name=”adults” placeholder=”Adults” />
<input type=”number” name=”children” placeholder=”Children” />
<input type=”text” name=”promo-code” placeholder=”Promocode” />
<button type=”submit”>Submit</button>
</form>Thanks
StevenOctober 24, 2018 at 4:03 pm #1025952Hey Steven,
Thank you for using Enfold.
What do you mean by “tag”? Are you trying to target the theme’s contact form button?
Best regards,
IsmaelOctober 25, 2018 at 10:58 am #1026281Hi Ismael, thanks for the response.
Yes, I think I need to target the contact form button. Please see instructions below. I can provide full instructions if required.
StevenInstall the Javascript Tag –
<script id=”guestline-tag” src=”https://tag.guestline.net/static/js/tag.js” data-groupid=”D_EDINBURGH” async></script>Setting up a simple form –
Adding the tag “data-guestline-form” to the <form> is all that is required to activate the form itself.<form data-guestline-form>
<select name=”hotel-id” placeholder=”Hotel”>
<option name=”hotel” value=””>Any Apartment</option>
<option name=”hotel” value=”DESTYORK”>York</option>
<option name=”hotel” value=”HOTEL2″>Southside</option>
<option name=”hotel” value=”HOTEL3″>Rodney</option>
</select>
<input type=”text” name=”arrival” placeholder=”Arrival” />
<input type=”text” name=”departure” placeholder=”Departure” />
<input type=”number” name=”adults” placeholder=”Adults” />
<input type=”number” name=”children” placeholder=”Children” />
<input type=”text” name=”promo-code” placeholder=”Promocode” />
<button type=”submit”>Submit</button>
</form>October 26, 2018 at 5:34 am #1026626Hi,
Thanks for the update.
This script should add that attribute in the theme’s contact form element.
function ava_guestline_form_attr(){ ?> <script> (function() { const f = document.querySelector('.avia_ajax_form'); if(f) f.setAttribute("data-guestline-form", ""); return null; })(); </script> <?php } add_action('wp_footer', 'ava_guestline_form_attr');
Best regards,
IsmaelNovember 1, 2018 at 1:32 pm #1028840Hi Ismael
Thanks for the response and code. I’ve added this in the child theme functions.php
You can see the test form on the left (NOT pop-out widget on right) on this page: http://destinationedinburghapartments.co.uk/new/york-place-enfold-form/
The contact form Submit button doesn’t function to send the user to the correct url, am I missing something?
I’ve added login details in private.
Thanks
StevenNovember 5, 2018 at 9:14 am #1029800 -
AuthorPosts
- You must be logged in to reply to this topic.