Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can have Checkbox & Textfield together ????

 
Trupti Mehta
Ranch Hand
Posts: 79
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

I want a form with a list of checkboxes alson with text fields. i.e.
ChkBox TEXT TextField
All in the same line. I added checkbox & text, but wondering how to add textfields next to it on the same line. The class is a Form and the code is :



Any idea on how to do this, would be greatful. Or some other concept or method to achieve the goal.

 
Sukitha R Udugamasooriya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trupti Mehta,

I'm sorry, what you ask is not possible in MIDP 2.0. But there will be some other concepts which can implement your idea.

I have faced a similar circumstance. In the scenario,

I used TextFields instead of ChoiceGroups. I used label of the fields as the product name and the user input value as the quantity. So if the textField.getString() method returns "", it will be equal to an unselected Choice element.

Hope you'll get my point.


Good Luck
 
Trupti Mehta
Ranch Hand
Posts: 79
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sukitha wrote:Trupti Mehta,
I used TextFields instead of ChoiceGroups. I used label of the fields as the product name and the user input value as the quantity. So if the textField.getString() method returns "", it will be equal to an unselected Choice element.


Thanks Sukitha,

At present, I managed other way. I had to display name, 2 figures & quantity if selected. And on cliking/selecting any product let the user enter its quantity. In the choicegroup, I added the full formatted string of all values & on selecting a product, a new form with complete product details and textfield to enter quantity. It works as expected at present.

This is also a good idea to display textfields as many products and set their label as formatted strings. If the client asks to have textfield in same window, then I will definetely implement this idea.

Thanks a lot for this idea.

Regards,

Trupti
 
Sukitha R Udugamasooriya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mehetha,

I value your concept as well.

All the best with your implementation.

regards,
 
Rajesh Gopu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

use the LAYOUT_2
Form frm = new Form("test");
String[] choices = new String[]{"Choice1" ,"Choice2" ,"Choice3"};
ChoiceGroup group = new ChoiceGroup("Group",ChoiceGroup.MULTIPLE ,choices ,null);
group.setLayout(ChoiceGroup.LAYOUT_2);

TextField txtField = new TextField("Text ","",9 ,TextField.ANY);
txtField.setLayout(TextField.LAYOUT_2);

frm.append(group);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic