Legend option for Contact Form

resolved (25 posts) (7 voices)

  1. royanger
    Member

    I am trying to create a contact form for my site. The form would start with some basic information, like the person's name, email and phone. Then there would be a title/header (or the legend tag from html) that says "Please select the days you can come in for a consultation:" and the user would select the days of the week that apply.

    I can obviously add checkbox fields for the user to select, but I don't see how to add the title for that section. If I try to just type in a title it doesn't display. I don't see any contactform shortcodes in the documentation that would apply.

    Is there an option I can use for this?

    Posted 2 years ago #
  2. Elliott
    Support

    Hello royanger,

    Let's try this,

    Open up /wp-content/themes/[your_theme]/lib/shortcodes/16-contact.php and on lines 111 - 115 you should see this,

    if( $matches[1][$i] == 'checkbox' ) {
    	$out .= '<input type="checkbox" name="' . $field_id . '" id="' . $field_id . '" class="styled' . $required_error . ( $required ? ' required' : '' ) . '"' .
    	( isset( $_POST[$field_id] ) ? ' checked="checked"' : '' ) . ' value="1" />';
    	$form_inputs['fields'][$field_id] = array( 'type' => $matches[1][$i], 'label' => $label, 'required' => $required );
    }

    On the next line add this,

    if( $matches[1][$i] == 'text' ) {
    	$out .= $matches[2][$i]['content'];
    }

    Now you can add HTML inside your shortcode like so,

    [contactform email = "you@company.com"]
    [name label="Name"]
    [email label="Email"]
    [text content = "<h4>Here is a title</h4>"]
    [textarea label="Message"]
    [/contactform]
    Posted 2 years ago #
  3. royanger
    Member

    That worked perfectly. Thanks.

    Posted 2 years ago #
  4. RTLGregory
    Member

    I also need to add text before a field, sorry as a non-techie I´m not sure what you mean by

    "Open up /wp-content/themes/[your_theme]/lib/shortcodes/16-contact.php "

    Please advise - I also have same issue outstanding on links not working in testimonials

    many thanks

    Posted 2 years ago #
  5. Elliott
    Support

    You have to open up the file in a text editor and edit it as seen in the instructions.

    I recommend using Filezilla to login to your server and download the file, http://wiki.filezilla-project.org/Using. After editing you'll need to upload it back to your server to see the changes.

    Posted 2 years ago #
  6. Elliott
    Support

    Here are the instructions for the latest versions,

    Open up /wp-content/themes/[your_theme]/lib/admin/classes/option-generator.php and on line 644 you should see this,

    )

    Change it to this,

    ),
    array(
    'name' => __( 'Custom', MYSITE_ADMIN_TEXTDOMAIN ),
    'desc' => __( 'Lets you add HTML in between the form fields.', MYSITE_ADMIN_TEXTDOMAIN ),
    'options' => 'html'
    )

    And around line 736 you should see this,

    $out .= '<a class="submitdelete contactform_field_deletion" id="delete-1" href="#">' . __( 'Remove', MYSITE_ADMIN_TEXTDOMAIN ) . '</a>';

    Right above that line add this,

    if ( strpos( $value['options'], 'html' ) !== false ) {
    $out .= '<textarea name = "sc-contactform-html-#" type = "text" value = "" class = "mysite_textfield" id = "sc-contactform-html-#"></textarea><br />';
    }

    Next open up /wp-content/themes/[your_theme]/lib/shortcodes/16-contact.php and on line 166 you should see this,

    $out .= '</div>';

    Above that add this,

    if( $matches[1][$i] == 'custom') {
    	$out .= $matches[2][$i]['html'];
    }

    Now you can use the shortcode generator and add html content in the contact form.

    Posted 2 years ago #
  7. jipsa78
    Member

    Hi Elliot,

    Can this be a standard feature in the next update please?
    I try to touch the core files as little as possible :-)

    Posted 1 year ago #
  8. Elliott
    Support

    Yes we'll most likely be adding something like this soon.

    Posted 1 year ago #
  9. samnasr
    Member

    hi there i see this post however, i just to change the wording over the captcha box. for example instead of just having 10+10 only , can i have it say 10+10=? . I totally understand that one should add the sum but i guess some people arent so perhaps adding =? should do the trick .
    Thank you

    Posted 1 year ago #
  10. samnasr
    Member

    Thank you for the article , im not very good with php code. what line should i be looking at editing. it all looks martian to me

    Posted 1 year ago #
  11. Elliott
    Support

    Around line 91 you should see this,

    $label = $num1 .' + '. $num2 . ' ';

    Change it to this,

    $label = $num1 .' + '. $num2 . ' = ';

    Posted 1 year ago #
  12. samnasr
    Member

    yes thank you i actually figured it out and forgot to tell you that i got that solved. however i still need to edit the captcha in the footer widget .is that in a different file

    Posted 1 year ago #
  13. Elliott
    Support

    If it's our contact form then it should be applied there as well.

    Posted 1 year ago #
  14. samnasr
    Member

    yes it is the widget contact form. here is the link you can take a look . the captcha responded in the shortcode contact form on other pages but not the widget contact form in the footer
    http://hilarybendon.com

    Posted 1 year ago #
  15. Elliott
    Support

    So are you wanting to move the submit button above the captcha?

    Posted 1 year ago #
  16. samnasr
    Member

    No. all i want is to add =? next to the captcha 1+1 so it becomes 1+1=?. The changes i made in
    /wp-content/themes/[your_theme]/lib/shortcodes/16-contact.php. line 91 only affected the captcha wording for the shortcodes contact forms and NOT the captcha in the contact form widget .
    i want to ad the =? to the captcha of the contact form widget

    Posted 1 year ago #
  17. Elliott
    Support

    Drag over a text widget and use our contact form shortcode inside.

    Posted 1 year ago #
  18. jipsa78
    Member

    Hi Elliot,

    Any idea why the captcha adjustment isn't working on my site?
    I've changed the code to:

    $label = $num1 .' + '. $num2 . ' =?';

    But nothing happens.

    I'll PM you the URL's.

    Posted 1 year ago #
  19. Elliott
    Support

    There is one on line 91 and another on line 180.

    Posted 1 year ago #
  20. jipsa78
    Member

    Thanx, missed the second one!

    Posted 1 year ago #
  21. kcurtis113
    Member

    Instead of starting a new thread I thought I would post my question here to keep it all together.

    I need to do something similar to this request, but I need to put a title before the captcha so it looks like the following:

    "title: 1 + 1 ="

    I've tried editing those 2 lines and I'm doing something wrong because I keep getting errors. Any advice??

    Posted 1 year ago #
  22. Elliott
    Support

    What your wanting to do is this,

    $label = 'title: ' . $num1 .' + '. $num2 . ' =';

    Posted 1 year ago #
  23. kcurtis113
    Member

    Awesome! It works perfectly. Thanks

    Posted 1 year ago #
  24. evaw
    Member

    Just a thought for others, I don't remember how I stumbled onto this, but adding [select label="text"] before your "multiple choose answer" worked for me. I've used this in elegance and in method.

    [select label="How did you hear about us?"]
    [checkbox label="Friend/Word of Mouth"]
    [checkbox label="Social Media"]
    [checkbox label="Internet Search"]

    Posted 4 months ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme