[CLOSED] Read Value from Dynamically Generated Radio Group

  1. #1

    [CLOSED] Read Value from Dynamically Generated Radio Group

    I have a dynamically generated form working off of questions in a database. Here's how the radio group/options are generated.

    if (question.QuestionType.TypeName == "radio"){
       ext.RadioGroup RadioGroup = new ext.RadioGroup()
        {
          ID = "q" + question.FormQuestionID.ToString(),
          FieldLabel = question.QuestionText,
          LabelAlign = ext.LabelAlign.Top,
          MaxWidth = 400,
          };
       List<QuestionOption> Options = (from o in MyConn.QuestionOption
                                                        where question.FormQuestionID == o.FormQuestionId
                                                        select o).ToList();
       foreach (QuestionOption o in Options)
       {
          RadioGroup.Items.Add(new ext.Radio()
          {
             ID= "o" + o.QuestionOptionId.ToString(),
             BoxLabel = o.OptionName,
             Value = o.QuestionOptionId.ToString(),
             MaxWidth = 50,
             Padding = 5,
             Margin = 5
          });
       }
    
    
       MyContainer.Items.Add(RadioGroup);
    }
    After the form is filled out, in PageLoad I regenerate the form, and then the Click Handler for the Submit Button fires. Here's how I iterate through the response if it's a radio button.

    if (question.TypeName == "radio")
     {
       FormAnswer Answer = new FormAnswer{
          FormQuestionID = question.FormQuestionID,
          Answer = Request["q" + question.FormQuestionID]
       };
       MyConn.FormAnswer.Add(Answer);
    }
    For text, textarea, datepicker, and dropdown fields, the responses are captured and saved to the database properly. For the radio buttons, the Request["q" + question.FormQuestionID] is null.

    I also tried

    ext.X.GetCmp<ext.RadioGroup>("q" + question.FormQuestionID).CheckedItems[0].Value.ToString()
    and receive an Invalid cast exception on CheckedItems
    Last edited by Daniil; Oct 18, 2013 at 4:46 AM. Reason: [CLOSED]
  2. #2
    I got the radio values by following

    http://forums.ext.net/showthread.php...ted-radiogroup

    Is the same true for CheckBoxes?
  3. #3
    Hi @ljankowski,

    Quote Originally Posted by ljankowski View Post
    Is the same true for CheckBoxes?
    Yes, I think it is the same with CheckboxGroup.

Similar Threads

  1. Replies: 9
    Last Post: Sep 16, 2013, 3:19 PM
  2. Replies: 5
    Last Post: Sep 02, 2010, 9:49 AM
  3. Retrieve checked radio from Radio Group
    By ttharaka2002 in forum 1.x Help
    Replies: 0
    Last Post: Mar 25, 2010, 2:15 AM
  4. [CLOSED] Dynamic Creation of Radio Buttons within Radio Group
    By Steve in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Mar 04, 2009, 1:13 PM
  5. Radio Group
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 0
    Last Post: Dec 04, 2008, 5:06 PM

Tags for this Thread

Posting Permissions