-
AuthorPosts
-
August 7, 2017 at 12:11 pm #835327
Hey guys,
I need to add a hidden input to my form with a subscriper ID.
I get the ID via JavaScript form the URL in a variable, but I have no Idea how to add this to the ajax form since they have no ID or name…Could you help me with that?
August 8, 2017 at 6:36 am #835701Hey lucaroehrl,
What code to want to add and to what element? Please try to be as specific as possible.
Best regards,
RikardAugust 8, 2017 at 12:07 pm #835802Ok I have the ajax form from the template builder.
I need to add a hidden element to this like this:
<input type="hidden" value="<id>" />
The id comes from the URL (see private content).
How do I add this to the form? Or is this even possible?August 8, 2017 at 1:13 pm #835819if that is your intention ( i can not see private content) – the honeypot strategy is allready implemented by Contact Form of Enfold for security reasons.
Line 440ff of contact.php in shortcodes:
//fake username field that is not visible. if the field has a value a spam bot tried to send the form $elements['avia_username'] = array('type'=>'decoy', 'label'=>'', 'check'=>'must_empty');
- This reply was modified 7 years, 4 months ago by Guenni007.
August 9, 2017 at 7:36 am #836199August 11, 2017 at 10:13 am #837366Not at all sadly…
I need that extra element to be filled out by javascript. Look this is the form code:
<form action="https://www.lythas.com/entscheidung/schritt-3/" method="post" class="avia_ajax_form av-form-labels-hidden avia-builder-el-6 el_after_av_codeblock avia-builder-el-last av-centered-form " data-avia-form-id="1" data-avia-redirect="">
There’s no actual ID that can be targeted via JavaScript. This doesn’t work:
document.getElementByDataAviaFormId("1")
Soooo, is there any way to target THAT SPECIFIC form? Or can attach an ID to that?
I thought a lot about this and instead of targeting the form I created the element and then targeted that:
<script type="text/javascript"> setTimeout(function () { var id = window.location.search.substr(1); document.getElementById("avia_9_1").type = "hidden"; document.getElementById("avia_9_1").value = id; }, 0); </script>
- This reply was modified 7 years, 4 months ago by Luca. Reason: I thought a lot about this and instead of targeting the form I created the element and then targeted that: ` setTimeout(function () { var id = window.location.search.substr(1); document.getElementById("avia_9_1").type = "hidden"; document.getElementById("avia_9_1").value = id; }, 0); `
August 12, 2017 at 7:50 am #837780August 12, 2017 at 11:48 am #837822Yep, solved :)
August 12, 2017 at 12:47 pm #837839Great! We’re glad you found a solution!
We’ll close this topic now. For any other questions or issues, feel free to post them here on the forum and we will do our best to assist you.
Thank you for using Enfold.
Cheers!
Sarah -
AuthorPosts
- The topic ‘Add hidden input to form’ is closed to new replies.