Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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?

    #835701

    Hey lucaroehrl,

    What code to want to add and to what element? Please try to be as specific as possible.

    Best regards,
    Rikard

    #835802

    Ok 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?

    #835819

    if 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, 3 months ago by Guenni007.
    #836199

    Hi,

    Thanks for sharing @guenni007, did you check that out @lucaroehrl?

    Best regards,
    Rikard

    #837366

    Not 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, 3 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); `
    #837780

    Hi,

    Thanks for sharing, did that solve your problem though?

    Best regards,
    Rikard

    #837822

    Yep, solved :)

    #837839

    Great! 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

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Add hidden input to form’ is closed to new replies.