Answer the question
In order to leave comments, you need to log in
How to pass a parameter to the form when calling it through an anchor?
There is a site with a catalog of resources, previews of which are displayed on the main page through pdoTools.
On the preview of each object there is a button for calling the feedback form in the fancibox. How to make it so that the called form would pass the hidden fields of the +pagetitle and +uri values of the preview from which it was called?
Lousy implementation: add a hidden form with predefined values to the template for displaying information about the resource (& tpl).
Then 9 (for example) product previews and 9 hidden forms will be displayed on the main page. But this is not only shitty code, but also very sad for the SEO. Therefore, you need to find an implementation option using only one form on the page, the hidden fields of which will be filled with hidden data from the product preview.
123 is replaced with the data-hidden-name value, 321 is replaced with the data-hidden-link value.
When the submit button is clicked, the FormIt sends a message.
Accordingly, three questions arise:
1) How to do it?
2) How to transfer data from the desired product preview when there are several of them on the page.
3) How to clean up these form values after submission so that you can repeat the maneuver with the next product?
Answer the question
In order to leave comments, you need to log in
You can do it with JS. Each time, in theory, there should be a different pagetitle, because. output via pdoTools
Html
<div class="pop-up">
<form method="post">
<input type="hidden" class="my_input">
</form>
</div>
$( "#button" ).click(function(){
var title = $(this).attr('title');
$('.pop-up').find('.my_input').val(title);
});
I implemented a similar task like this:
1) I added parameters to the modal window call -
2) Added snippets for pulling these parameters from the
par1 address bar -
<?php echo isset($_GET['par1']) ? $_GET['par1'] : '' ;
<?php echo isset($_GET['par2']) ? $_GET['par2'] : '' ;
<input type="hidden" name="par1" class="source" value="" />
<input type="hidden" name="par2" class="source" value="" />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question