cforms II User Forum

Registration is currently disabled.


Login form protected by Login LockDown.

Lost password?
Advanced Search

— Forum Scope —


— Match —


— Forum Options —


Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Show and hide textfields depending on a selectbox choice.
May 14, 2013
7:36 pm

Hi All,

Is it possible to show and hide textfields or other fields depending on a selectbox choice.

I guess I need dynamic fields, but I'm really not sure.

If yes, it would be nice to provide some hints!



May 14, 2013
8:36 pm

That's exactly what I'm looking for.  I hope someone can clarify this for us.

May 18, 2013
6:05 pm

Here is a solution with Javascript to hide and show two single text fields and one date field.

All your personal custom Javascript code should go into a separate file, e.g. my_javascript.js

  • cforms main config page: turn on 'Use custom input field NAMES & ID's'
  • cforms main config page: add a [id:selectbox] to the selectboxlabel, e.g.: Please select[id:wertung]
  • copy my_javascript.jsinto your WP theme folder and link to it from within your WP header.php file (usually), e.g.:

    <script type="text/javascript" src=""></script>

  • // JavaScript Document
    $(function() {    //set default value after site reload
    function afterSelected()
        if ((document.getElementById('wertung').value).indexOf('Team') >= 0)//Zeige zusätzliche Textfelder f. Namen, Nachnamen u. Geburtsdatum des 2. Fahrers
            $("#vornamef2").removeClass('single').addClass('single fldrequired');
            $("#namef2").removeClass('single').addClass('single fldrequired');
            $("#gd2").removeClass('single cf_date hasDatepicker').addClass('single fldrequired cf_date hasDatepicker');
        else//Zeige keine zusätzlichen Textfelder f. Namen, Nachnamen u. Geburtsdatum des 2. Fahrers
            $("#vornamef2").removeClass('single fldrequired').addClass('single');
            $("#namef2").removeClass('single fldrequired').addClass('single');
            $("#gd2").removeClass('single fldrequired cf_date hasDatepicker').addClass('single cf_date hasDatepicker');        
    $(document).ready( function () {
      $("#wertung").change( function () { afterSelected(); } );
  • cforms styling page: in the cforms.css set the resepctive list elements to not show, e.g. : "li#li-2-18, li#li-2-19,li#li-2-20 {display: none;}
June 19, 2013
9:51 am
sanjay kumar



// JavaScript Document

if (typeof jQuery == 'undefined') {  

    alert("jQuery is not loaded")   
} else {
   alert("jQuery is loaded") 
function afterSelected()
    if (document.getElementById('checkbox').checked == true)
       $("#selectiontext").removeClass('single').addClass('single fldrequired');
        $("#selectiontext").removeClass('single fldrequired').addClass('single');
$(document).ready( function () {
  $("#checkbox").click( function () { afterChecked(); } );
Use custom input field NAMES & ID's >> on

I get message jquery is loaded
i dont get hi message 
is there any other setting i am missing....
Thanks a lot!
Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3757

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5355

Posts: 18732

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)