M
M
Mikhail Mirgorodsky2020-10-29 11:13:13
Joomla
Mikhail Mirgorodsky, 2020-10-29 11:13:13

How to place multiple HTML forms on one page?

There is a joomla+virtuemart product category page. On this page, I added a form module to the product card, so there are 10 products per page, and 10 identical forms are obtained.
The question is how to do it so that 10 letters would not come to the post office, but only one at a time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
exmmth, 2020-10-29
@PiZZaDoXa

Mikhail Mirgorodsky , show a link to the site, there is an excellent domestic solution for joomla forms Radical form is very flexible and easy to use.
Regarding your site, why do you need 10 forms on the site, if it’s easier to make one form and a call button like this:

<button class="mt-2 mb-2 btn" type="button" ....
data-toggle="modal" 
data-target="#modal"
data-modal-title="Заголовок в форме"
data-modal-textarea="Описание в форме">Купить в один клик</button>

On js, process the data-modal-* data on click and replace it in the form.
$('[data-toggle="modal"]').on('click', function(){
    let form = $($(this).data('target'));
    if(typeof $(this).data('modal-title') !== 'undefined'){
        form.find('.modal-title').html($(this).data('modal-title'));
    }else{
        form.find('.modal-title').html(form.find('.modal-title').data('default'));
    }
    ...
});

and in the layout of the form we add the default value data-default="by default" , where necessary
<h5 class="modal-title" id="call-category" data-default="Заголовок по умолчанию">...</h5>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question