Hello @guglielmirent
The number 600 is not a URL parameter, database, JSON, or any other datasource. So, you can get this value via javascript directly.
Assuming the number field is <input type="number" name="my_number">, you can insert a script tag in the form with the following piece of code:
<script>
jQuery(document).on('click', '[href="#contact"]', function(){
jQuery('[name="my_number"]').val(jQuery(this).attr('data-price1'));
});
</script>
Best regards.
Sorry but it doesn’t work, this solution!
maybe i explained it wrong,
the 600 is not a fixed value but a dynamic one and is part of a post-type block.
Maybe that’s why it doesn’t work?
the link would be :
<a href="#contact" class="pbutton" onclick="reply_click(this)" data-prezzo="[ptb_field name='prezzo1']">[ptb_field name='prezzo1']</a>
the onclick=”reply_click(this)” function is a script that passes me data-price=”[ptb_field name=’price1′]” in the text field, the problem is that I would need it as a numeric value to create formulas in the contact form
maybe this makes the question a little more explicit
thanks in advance
Alternatively, since my script works with text fields, I could create a hidden text field and capture the value from that hidden field and insert it into the numeric field.
Is this possible?
ex:
[hidden price1 text]
hidden text capturing the dynamic value
[number price2]
numeric field where it is assigned
Hello @guglielmirent
The code you need is not related to our plugin because it does not use any data source.
Actually, all of them are links with href="#contact". So, you can insert a script tag with code:
<script>jQuery(document).on('click', '[href="#contact"]', function(){jQuery('[id="offerta_prezzo"]').val(jQuery(this).text());});</script>
But I insist this code is not related to our plugin.
Best regards.
Thank you, but my question about your plugin is whether it can retrieve data from a hidden text field and insert it into the number field, this is a related question to your plugin, would be the alternative I wrote previously
Hello @guglielmirent
Our plugin populates the form fields with values stored in third-party data sources (a Database, CSV file, JSON structure, ACF, URL parameters, Posts data, or taxonomy values). But you want to assign a field the value of another. You need a basic JS script:
<script>jQuery('[name="field-b"]').val(jQuery('[name="field-a"]').val());</script>
Best regards.
Unfortunately all these scripts don’t work, or I’m doing something wrong, I can’t figure out where I’m going wrong, I was convinced that your plugin could help me, but nothing