Field Value in HTML block
-
Hi.
It’s possible to put a <%fieldnameX_value%> in an HTML block?
E.G.
FieldnameX -> any block with a value.
HTML block -> “You have chose the Option A, that garantee to you a <%fieldnameX_value%> increment of…”
Where <%fieldnameX_value%> is the one selected in the block before.
Hope I’ve explain well.
Thanks in advance!
-
Hello @upyria
No, you can’t. The tags’ structures are used only in the thank you pages and notification emails. However, there is a workaround.
Assuming you want to include a text in an “HTML Content” field similar to:
You have chosen Option A, which guarantees to you a <%fieldnameX_value%> increment of…
Insert the text with the format:
You have chosen Option A, which guarantees to you a
<span class="value-here"></span>increment of…and then the equation in the calculated field would be similar to:
(function(){ var result = fieldname1+fieldname2; jQuery('.value-here').html(result); return result; })()Of course, it is a hypothetical example. You should use the real equation.
Best regards.
So I need to insert TWO blocks?
1) HTML Block with “You have chosen Option A, which guarantees to you a <span class=”value-here”></span> increment of…”
2) Calculated Field with (formula)
And hide the Calculated Fields from publi view?
Have I understand well?
Cause I have not a formula, but only a value to select.
It would be changed as:
(function(){
var result = fieldname1;
jQuery(‘.value-here’).html(result);
return result;
})()Right?
Hello @upyria
If the fieldname1 field is a dropdown or radio button field, it is possible to implement all the process directly in the “HTML Content” field with a code similar to:
You have chosen Option A, which guarantees to you a <span class="value-here"></span> increment of… <script> jQuery(document).on('change', '[id*="fieldname1_"]', function(){ jQuery('.value-here').html(jQuery(this).val()); }); </script>Best regards.
Wow, it works perfect, but I have a slider as source of the value.
So formatting is always without “.” for thousands and “,” for decimals.
Any ideas?
https://assicurainfortuni.com/medici/preventivatore/
Fieldname1 is the source
Fieldname 6 is to tick
Fieldname 21 is the html-
This reply was modified 5 years, 6 months ago by
upyria.
Hello @upyria
If the fieldname1 is a slider field, edit the script code as follows:
<script> jQuery(document).on('change', '[id*="fieldname1_"]', function(){ jQuery('.value-here').html(jQuery(this).attr('vt')); }); </script>Best regards.
It works perfect. “.” for thousands is good.
But it do not appears in the notification email. I’ve set the <%fieldname21%> to appear in the html. It’s because the code I insert in? Or because it’s a conditional field?
Where I’m wrong?
Hello @upyria
The fieldname21 is an “HTML Content” field, and the “HTML Content” fields are plain-texts. The plain-texts are not submitted to the server-side. So, they are not included in the notification emails and thank you pages.
If you want to include the same texts of the “HTML Content” fields in the notification emails, you must enter these texts directly into the “Message” attributes in the form’s settings, corresponding to the notification and confirmation emails.
For more information about the special tags, please, read the following page of the plugin’s documentation:
https://cff.dwbooster.com/documentation#special-tags
Best regards.
Fieldname21 is conditional.
I tried to use _block / _endoblock to make it appears, but it doesn’t happens.
<%fieldname6_block%><%fieldname21%><%fieldname6_endblock%>
I read the documentation, but I can’t find the correct code to add to the notification email to make it appears.
Hello @upyria
If the fieldname21 is an “HTML Content” field, it is not submitted to the server side. So, you should include in the notification email:
<%fieldname6_block%> Hai attivato la Supervalutazione!<br>Se subirai un infortunio agli arti superiori, visus e udito avrai una percentuale del 100% del tuo capitale Invalidità Permanente di € <%fieldname1_value%> <%fieldname6_endblock%>Best regards.
Aaaaah!
Sorry @codepeople, my fault! I’ve not understand well your previous tip.Case solved!
Thank you very much!
-
This reply was modified 5 years, 6 months ago by
upyria.
-
This reply was modified 5 years, 6 months ago by
The topic ‘Field Value in HTML block’ is closed to new replies.