cforms II User Forum

Registration is currently disabled.
Guest

FAQs

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 Related Topics
Creating an "Other" radio button w/ textfield
I need to create a radio button called "other" that allows the user to add a new option -detailed tutorial needed-
August 6, 2012
5:13 pm
Carlos
Guest

I need to create a radio button called "other" that allows the user to add a new option using cforms14.5 and worpress 3.4.1. This is the case:

Q. Your favourite colour is..

  • ( ) red
  • ( ) blue
  • ( ) other [specify]

I have read in the forum that this can be made by creating dynamic forms -but i have no idea how to do it and the help section is quite difficult for a newbie -. Does anyone knows about a step-by-step tutorial??

Thanks in advance!

August 7, 2012
12:13 pm
Carlos
Guest

I've just found how to solve it…The code -based on "http://www.deliciousdays.com/cforms-forum/troubleshooting/tutorial-select-box-selection-shows-hidden-fields/#p19866" for showing-up the textfield is the following:

————

$(document).ready(function() {
  $.viewMap = {
    '0' : $([]),
    'OTRO' : $('#id_of_the_textfied'),
  };
$.each($.viewMap, function() { this.hide(); });
  $('#id_of_the_radiobutton_other').change(function() {
    $.each($.viewMap, function() { this.hide(); });
    $.viewMap[$(this).val()].show();
  });
————

Now i'm trying to create a function that checks that if "other" is checked and "textarea" is empty returns an "pop-up error message" and if "other" is not checked and textarea is not empty returns other "pop-up error message".

Im beginning w/ my_cforms_action() but i think i'm not in the right direction. Any suggestions??

Thanks in advance.

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
21 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: 3761

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5358

Posts: 18739

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

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

Administrators: Oliver (6400), Nicky (3)