Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Radio button insert

    Hello,
    I have the following code in my project:

    <cfinput type="radio" name="gender" value="Female" checked="yes"> Female
    <cfinput type="radio" name="gender" value="Male"> Male

    Now i want to save the value of the selected radio button i.e. Male or Female
    into a database and I use the following code

    Insert into Consumer(...., gender,...) values (..., FORM.gender,...) but I get
    a no/yes value in my database instead of Female/Male.

    How do I get Female/Male to be recorded in the database instead of a yes/no
    depending on what the user selects?

    Abdlah Guest

  2. Similar Questions and Discussions

    1. radio button
      i have 2 radio button and i want to set the 1st one is defaul <CFSET typeA = 'exempt'> <INPUT type='radio' name='typeA' value ='exempt'...
    2. Radio Button vSpacing
      Hello! I know this has to be really simple, but I can't seem to get it right. I have a flash survey that pulls the questions and radio buttons...
    3. Radio Button Validation
      :o Hello, I am using CFForm and CFInput to construct a rather simple form. However, the javascript that I am using in the onvalidate event of one of...
    4. Radio Button Help me please!
      Hi I need help quick! let me explain my problem: Ičve made a form in flash with textfields and radio buttons. It submits the data from the...
    5. Insert Radio Group
      I did an insert Radio Group from the forms object. Is there a way for this tool to allow for multiple radio buttons to be checked instead of just...
  3. #2

    Default Re: Radio button insert

    What is the data type of the field in the database. I'd bet it is not text. Also, I you need '#FORM.gender#' in your values list in the insert statement.
    jdeline Guest

  4. #3

    Default Re: Radio button insert

    The datatype of the gender field is text, also I do have '#TRIM(Form.gender)#' in my insert statement, yet the value posted to the database is a yes/no type.
    Abdlah Guest

  5. #4

    Default Re: Radio button insert

    If you do <cfdump var="#form#"> what do you get for the gender?

    Originally posted by: Abdlah
    The datatype of the gender field is text, also I do have '#TRIM(Form.gender)#'
    in my insert statement, yet the value posted to the database is a yes/no type.



    Dan Bracuk Guest

  6. #5

    Default Re: Radio button insert

    Hi,
    when I do <cfdump var="#form#"> I get male or female for gender.
    Abdlah Guest

  7. #6

    Default Re: Radio button insert

    You don't need to trim the form variable, even though that is probably not what
    is causing your problem. If you have debugging turned on, put a cfabort after
    your input query so you can read the sql.

    Do all the other fields receive their expected values?

    Dan Bracuk Guest

  8. #7

    Default Re: Radio button insert

    Actually, something really weird happened, I accidentally closed dreamweaver
    and had to start it again, and now the database recieves the right value. I
    don't understand what happned. Now I have a series of On values and one Male
    value for my last submission.

    This happened after I tested the action page with the cfdump you suggested.

    Thanks for the help.

    Abdlah Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139