Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Please HELP!!! Survey building problem (passing variable)

New Here ,
Mar 23, 2008 Mar 23, 2008
If anybody can help I would very very appreciate this!

The problem is that I’m trying to build a survey! In admin screen there is choice of questions to create (check box, radio, combo and comments)

Once admin creates questions with particular radio buttons set, then he can add answers with radio buttons next to it.

Then it adds all that to database.

For users to see this survey with multiple questions and answers I have created form in which all this is visible. For radio buttons to appear I need to loop through the query which selects all created questions and answers. However, for radio buttons to appear as grouped I use name = #questionID# from query – so that radio buttons will be grouped for each question.

My problem is since it is like:

<CFLOOP query="radioCheckView">

<INPUT type="Radio" name=" #questionID #" value="<CFOUTPUT>#RadioQuest#</CFOUTPUT>"> <CFOUTPUT>#RadioQuest#</CFOUTPUT><br>

</CFLOOP>

Once user submits the form, all answers should be inserted into database.
How then this radio button can be identified when you submit?

<CFIF isDefined("Form.Submit")>
<CFOUTPUT query="ViewQuests">
<CFQUERY name="UserInsert" datasource="surveyDB">
INSERT INTO answers
(questID, comments, radio)
VALUES
(
#questID#,

'#form.comment#',

'#form.??????????? #' – “Don’t know what should I write here this should be a radioButton Name which is mentioned above”
)
</CFQUERY>

</CFIF>


Please guys if you know how to solve this problem – help me!

THANK YOU VERY VERY MUCH IN ADVANCE!
TOPICS
Getting started
459
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2008 Mar 23, 2008
Hi

You have to give one more checking in side the <cfoutput> condition before trying to insert

Please check the radio button is defined inside your <cfoutput> and then insert your value to the table.
I think this will fix your issue.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 24, 2008 Mar 24, 2008
Here is an example that answers your question. Remarks:

1) There is, as usual, just one name for the radio fields. It is assigned dynamically as #questionid#.

2) The radio fields have different values, also assigned dynamically by means of the array radioquest.

3) When the form is submitted the dynamic value #questionid# will not exist on the action page. One solution is to store it in a hidden field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2008 Mar 28, 2008
LATEST
Hi,
the radio buttons,checkboxes,Multi select dropdown etc will only be defined if they are selected in the form. So while using these u have to check whether they are defined or not, then u have to do the DB operations.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources