Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #20869

    Hi,

    I’m using the Flashlight theme – great theme by the way :-)

    I’d like to add a select drop down or some options through radio buttons to the contact form.

    I’ve found the files responsible (contact-form.php and class-form-generator.php).

    I see you have support for select inputs. Could you help me out on what syntax to use in the contact-form.php to add a select?

    Let’s say I wanted to add a select with some default option selected and 2 more options available.

    If I wanted to also add some options with radio buttons, is there some easy way to do this too?

    Thanks,

    Achilles

    #109430

    Hi Achilles,

    A much easier way to do it would be to use a plugin like Contact Form 7 and then not use the built in contact form. That way you get a much easier interface for customizing the form(s) you need.

    Regards,

    Devin

    #109431

    Hi,

    I’ve used this plugin before. I ‘d just prefer to avoid adding a plugin just for a contact form if I can do it through the theme.

    Regards,

    Achilles

    #109432

    You can add your custom contact form fields to wp-contentthemesflashlightincludescontact-form.php

    If you want to add a select field after the existing/standard fields replace following code in contact-form.php

    'username'	=> 	array('type'=>'decoy',	'label'=>'', 'check'=>'must_empty'),										//decoy input field for bots, input field gets hidden, if bot enters value form wont be submitted

    with:

    'username'	=> 	array('type'=>'decoy',	'label'=>'', 'check'=>'must_empty'),										//decoy input field for bots, input field gets hidden, if bot enters value form wont be submitted
    'mycustomselect' => array(
    'type'=>'select',
    'label'=>'Are you hungry?',
    'options'=> 'Yes,No,Maybe,I am Vegetarian',
    'check'=>''
    )

    You can change:

    1) The field name – it’s “mycustomselect” in the example code above,

    2) The caption/label – it’s “Are you hungry?” in the example code and

    3) the options. Separate the options with a comma (,). I used: “Yes,No,Maybe,I am Vegetarian” in the sample code above.

    #109433

    Thanks, that’s what I was looking for.

    #109434

    Hi!

    Glad that I could help you :)

    Regards,

    Peter

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘contact form dropdown or radio’ is closed to new replies.