multiple-choice

Symfony2 multiple choice is not validating

不羁的心 提交于 2019-12-06 09:20:24
I'm creating a simple list of shop carts with users and products assigned to it. My form for new cart looks like this: public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('cartName', 'text', array('label' =>'Nazwa koszyka:')) ->add('user', new UserForm(), array('data_class' => 'Zadanie\Bundle\Entity\User', 'label' => false)) ->add('products','entity', array('label' => 'Wybierz produkty:', 'class' =>'Zadanie\Bundle\Entity\Product' , 'multiple' => true, 'required' => true)) ->add('Zapisz', 'submit'); } and everything is great except that i can submit the form

Django - Choices for Models

时间秒杀一切 提交于 2019-12-04 17:23:38
I have been searching and looking through docs, but I want to ask and confirm for the best solution here. Trying to define model choices. 'yes, no and not sure' choice From Radio Select How would I define for Multiple Choices Simple Example: In my models.py, I have class Property(models.Model): name = models.CharField() class Feature(models.Model): YES_CHOICES = ( # example of 1, there can be only one selection ('YES', 'Yes'), ('NO', 'No'), ('NOT_SURE', 'Not Sure') ) PARKING_CHOICES = ( # example of 2, there can be multiple selections ('GARAGE', 'Garage'), ('STREET', 'Street'), ('PRIVATE_LOT',

Multiple choice alert dialog with custom row layout

亡梦爱人 提交于 2019-12-04 15:25:49
I need to create an AlertDialog with multiple choice items but I'm having some trouble trying to set a custom layout file to the internal ListView. For single choice items I use a constructor that takes a ListAdapter as parameter and this way I can set the proper layout resource for each row: builder.setSingleChoiceItems(new ArrayAdapter<String>(getActivity(), R.layout.list_item_single_choice_answer, items), checkedItem, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { checkedItem = which; toggleEditTextAnswer(checkedItem == (items

Multiple choice AlertDialog with custom Adapter

女生的网名这么多〃 提交于 2019-11-30 13:11:21
I am trying to create a AlertDialog with multiple choice option. I have tried with the setMultiChoiceItems but what i have is a ArrayList<Category> and not a CharSequence so i tried with the adapter. The problem with setAdapter is that when i select one item it closes the dialog window. And what i want is to select the items and then hit the OK button to see what items where selected. AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Pick a color"); ArrayAdapter<Category> catsAdapter = new ArrayAdapter<Category>(this, android.R.layout.select_dialog_multichoice,this

Android random multiple choice quiz: how to identify correct answer

假如想象 提交于 2019-11-30 10:58:51
I'm trying to create a random multiple choice quiz for android. I want to display a random question from a stringarray, with the corresponding answer from another string array showing up in one of the four options. The other three options will come from another string array, which will be used provide the "wrong" answers for all the questions, randomly. Two questions: Is there a better way to make a multiple choice quiz like this? -and- When the player selects an answer, how do I identify which array the answer came from? This is the code I'm using to randomize: String[] question = { /

Multiple choice AlertDialog with custom Adapter

被刻印的时光 ゝ 提交于 2019-11-29 18:34:51
问题 I am trying to create a AlertDialog with multiple choice option. I have tried with the setMultiChoiceItems but what i have is a ArrayList<Category> and not a CharSequence so i tried with the adapter. The problem with setAdapter is that when i select one item it closes the dialog window. And what i want is to select the items and then hit the OK button to see what items where selected. AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Pick a color"); ArrayAdapter

Android random multiple choice quiz: how to identify correct answer

痴心易碎 提交于 2019-11-29 15:52:12
问题 I'm trying to create a random multiple choice quiz for android. I want to display a random question from a stringarray, with the corresponding answer from another string array showing up in one of the four options. The other three options will come from another string array, which will be used provide the "wrong" answers for all the questions, randomly. Two questions: Is there a better way to make a multiple choice quiz like this? -and- When the player selects an answer, how do I identify

Multiple Choice Searchable ListView

旧巷老猫 提交于 2019-11-29 09:29:49
OK I have a multiple choice ListView that works fine. I check the boxes for the contacts (held in a String[]) and can return the values fine. Because some people have a bunch of contacts I wanted to create a search bar kind of like the stock one for the Android phone book. I created an EditText and aligned it above my list. I found the filtering code here on StackOverflow and it works wonderfully. My Problem: When you filter someones name out, and you select the name, when you either backspace from the EditText or continue typing, the correct position of the name you selected is not saved. For

Multiple Choice Searchable ListView

我是研究僧i 提交于 2019-11-28 02:57:19
问题 OK I have a multiple choice ListView that works fine. I check the boxes for the contacts (held in a String[]) and can return the values fine. Because some people have a bunch of contacts I wanted to create a search bar kind of like the stock one for the Android phone book. I created an EditText and aligned it above my list. I found the filtering code here on StackOverflow and it works wonderfully. My Problem: When you filter someones name out, and you select the name, when you either