Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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
    Steven

    We add the following script:
    <script id=”guestline-tag” src=”https://tag.guestline.net/static/js/tag.js&#8221; 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
    Steven

    #1025952

    Hey 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,
    Ismael

    #1026281

    Hi 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.
    Steven

    Install the Javascript Tag –
    <script id=”guestline-tag” src=”https://tag.guestline.net/static/js/tag.js&#8221; 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>

    #1026626

    Hi,

    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,
    Ismael

    #1028840

    Hi 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
    Steven

    #1029800

    Hi,

    Where should it send the user? The “data-guestline-form” attribute is correctly applied to the form. Please contact the script author for additional help.

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.