Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #389175

    Hello,

    I am calling a do_shortcode in a custom template for the contact form.
    I need some field to be hidden and prepopulate with some data.

    I tested:
    [av_contact_field label='Name' type='hidden' options='' check='' width='' value='Pippo'][/av_contact_field]

    but it didn’t work. Do you have any idea to hook this?

    thanks!

    #389711

    Hey Gurify!

    Can you send us a link to your page and paste the full customization your doing here so we can get a better idea?

    A screenshot highlighting what your trying to do would be helpful too.

    Regards,
    Elliott

    #389840

    Hello Elliot and thanks for support,

    I try to better explain what I would like to do.
    I want to use the shortcode generated by the contact module in the layout builder.

    <?php 
    echo do_shortcode( "[av_contact email=' (Email address hidden if logged out) ' title='' button='Inviare' on_send='' sent='La tua domanda è stata inviata!' link='manually,http://' subject='' autorespond='' captcha='' color='']
    [av_contact_field label='Nome' type='text' options='' check='is_empty' width='element_half'][/av_contact_field]
    [av_contact_field label='E-Mail' type='text' options='' check='is_email' width='element_half'][/av_contact_field]
    [av_contact_field label='Messaggio' type='textarea' options='' check='is_empty' width=''][/av_contact_field]
    [/av_contact]" ); 	
    ?>

    This code is working, but I woul like to hide the name, email, and object, becuase the name is the user name, the email is the email of the user and the object is the url of the page. So I need a way to hide and also to assaign the values to that fields.

    thanks!

    #390867

    Hi!

    I’m sorry but I’m not sure I understand. Go ahead and send us a link to your page and take a screenshot highlighting what your trying to do so we can get a better idea.

    Best regards,
    Elliott

    #391068

    Ok,

    i try to explain this as clearly as I can.
    A screenshot of the page is not useful, because you’re going to see a normal page with a normal contact form on it.
    Here it is the code of a single.php page ( cleaned from the unnecessary code for this purpose )

    <?php
    
    get_header();
    
    echo do_shortcode( "[av_contact email=' (Email address hidden if logged out) ' title='' button='Inviare' on_send='' sent='La tua domanda è stata inviata!' link='manually,http://' subject='' autorespond='' captcha='' color='']
    [av_contact_field label='Nome' type='text' options='' check='is_empty' width='element_half'][/av_contact_field]
    [av_contact_field label='E-Mail' type='text' options='' check='is_email' width='element_half'][/av_contact_field]
    [av_contact_field label='Messaggio' type='textarea' options='' check='is_empty' width=''][/av_contact_field]
    [/av_contact]" ); 	
    
    get_footer();
    
    ?>

    as you can see the shortcodes are exactly the shortcodes that the layout builder uses to generate the contact form.
    I would like to know how to hide a field, but give a valure to hit. Example: the filed “name”. I want to hide it from the frontend, such a hidden file does, but I want to give it a value ( the username ) and receive it in the email.

    I tried

    [av_contact_field label='Nome' type='hidden' options='' check='is_empty' width='element_half' value='Pippo'][/av_contact_field]

    but with no succes.

    #391224

    Hey!

    That won’t work because the av_contact_field shortcode doesn’t recognize hidden as a type parameter. I’d suggest using an specialized plugin like Contact Form 7, it is possible to make it look exactly as the Enfold one.

    Regards,
    Josue

    #391234

    Ok, I can hide it with css no problem, and what about to assign a value to them. Is it possible?
    thanks!

    #391245

    Hey!

    That would be possible on the client side using a custom JavaScript script (jQuery val), what values do you want to assign to them?

    Best regards,
    Josue

    #391845

    Hello Josue,
    I would like to assign the $user in the Name field, and the $email in the email fields.
    thanks!

    #391855

    Hi!

    Where are those variables defined? can you post a link to the page where you are trying this?

    Cheers!
    Josue

    #391999

    They are in the php template file I am making: single-custom_post_name.php

    #392258

    Hi!

    OK, here’s a rough example of what you’d need to implement in your template file (check comments):
    http://jsbin.com/rexibuxihe/1/edit?html,output

    Best regards,
    Josue

    #393625

    thanks so much Josue!

    #393967

    You are welcome, always glad to help :)

    Regards,
    Josue

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.