#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    3
    Rep Power
    0

    Radio buttons... getting desasperate


    Please help, I just don't come out.....

    On my index page I have radio buttons coming from database:

    <TD>
    <CFINPUT name="#QuestionID#" TYPE="Radio" value="#AnswerID#" checked="no"> #Answer#
    </TD>

    When I want to insert the database I'm getting errors.....
    I was trying something like this but of course it doesn't work
    because name of the field is a dynamically generated number (QuestionID)
    <CFQUERY DATASOURCE="#DS#" NAME="insert">
    Insert INTO tblEnquete
    (
    QuestionID,
    AnswerID
    )
    VALUES
    (
    #QuestionID#,
    #AnswerID#
    )
    </CFQUERY>

    Someone knows? Thanks a lot in advance!! ! ! !

    test page is: http://62.131.141.237/enquete
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Netherlands
    Posts
    99
    Rep Power
    11
    You could try to debug your query to actually see what the values are that are being inserted in the database.

    i.e.:

    <!--- <CFQUERY DATASOURCE="#DS#" NAME="insert"> --->
    <cfoutput>
    Insert INTO tblEnquete
    (
    QuestionID,
    AnswerID
    )
    VALUES
    (
    #QuestionID#,
    #AnswerID#
    )
    <BR></cfoutput>
    <!--- </CFQUERY> --->
    This may get you a step further.
    Last edited by DeepDown; August 2nd, 2003 at 03:56 AM.
    ** Don't expect me to code your needs, but if I am able to help, I'm willing. Shout, grab and use the hand!
    ** Man can no more own the land we walk upon, as they can lay claim on the air that we breath
    ** DeepDown I'm addicted to structures.... ohw and music
    ** Almost forgot I had an account here [*o*]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    3
    Rep Power
    0
    Hi DeepDown,
    thanks... but it doesn't work:

    the problem is that the field name

    #QuestionID# is dynamically generated

    so, once is this 34 next time 22... and so on....

    and the column name in the db is QuestionID. So I should have
    something like: insert VALUE #QuestionID# .... but the name of the field is 34 or 22 .... and not #QuestionID#.....

    but I don't know the name of the field.... because it is every time different.....
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Netherlands
    Posts
    99
    Rep Power
    11
    I assume that after the post, you don't know what the names of the formfields are that you have submitted?

    In that case:
    Use the #FORM.FIELDNAMES# collection in the page you post your form-data to, in order to get the names of the fields you have actually submitted.

    i.e.:

    <CFOUTPUT>
    <CFLOOP LIST="#FORM.FIELDNAMES#" index="FRMFIELD">
    Fieldname and -value:<BR>
    #FRMFIELD#: #EVALUATE(FRMFIELD)#<BR>
    </CFLOOP>
    </CFOUTPUT>
    ** Don't expect me to code your needs, but if I am able to help, I'm willing. Shout, grab and use the hand!
    ** Man can no more own the land we walk upon, as they can lay claim on the air that we breath
    ** DeepDown I'm addicted to structures.... ohw and music
    ** Almost forgot I had an account here [*o*]
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    3
    Rep Power
    0
    Yes! It works!
    Than you very much!

IMN logo majestic logo threadwatch logo seochat tools logo