J
J
Jimmy Neutron2018-07-14 07:29:25
WordPress
Jimmy Neutron, 2018-07-14 07:29:25

How to pass value from Span to Contact Form 7?

Guys, such a question.
There is a drop-down list on the site and under it the order button, it opens a modal window. The form is made on Contact Form 7. The question is, how can I pass the value from the drop-down list when submitting the form?
Writing a separate form is not an option

Picture 1
5b497b656a84a361713087.png
Picture 2
5b497b77441c5665318847.png
Dropdown code (if needed)
<div class="delivery_block active">
  <div class="delivery_list"><div class="btn"> </div>
    <span class="choose">10 х 15 х 7</span>
    <span class="anymore"><b>все <br> размеры</b></span></div>
  <ul class="cities_list" style="display: block;">
    <li>10 х 15 х 7</li>
    <li>10 х 15 х 8</li>
    <li>10 х 15 х 9</li>
    <li>10 х 15 х 10</li>
    <li>10 х 15 х 7</li>
    <li>10 х 15 х 8</li>
    <li>10 х 15 х 9</li>
    <li>10 х 15 х 10</li>
  </ul>
</div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lamer350, 2018-07-14
@SkyShot

in CF7 you need to create hidden field type="hidden"
in js add handler

$('.cities_list li').on('click', function(){
    var size = $(this).text();
    $('#ID_hidden_input').val(size);
});

This option will suit you if by default you do not have any of the sizes selected and will be: Select the size.
Otherwise, when sent, #ID_hidden_input will be empty.

O
Orkhan Hasanli, 2018-07-14
@azerphoenix

In theory, you can pass the value to the contact form using js code on the client side. Hang the handler on the modal open button and when clicking on it, pass the selected value to the field.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question