hi,
you please try the following MessageForm class . And tell me if its working for you or not.I think this is your requirment.
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
public class MssageForm extends Form implements CommandListener
{
TextField name,rollNumber,age;
private Command submit,cancel;
public MssageForm(String title)
{
super(title);
name=new TextField("Name::"," ",50,TextField.ANY);
age=new TextField("Age::"," ",50,TextField.ANY);
rollNumber=new TextField("RollNumber::"," ",50,TextField.ANY);
submit=new Command("Submit",Command.SCREEN,1);
cancel=new Command("Cancel",Command.BACK,1);
this.append(name);
this.append(age);
this.append(rollNumber);
this.addCommand(submit);
this.addCommand(cancel);
this.setCommandListener(this);
}
public void commandAction(Command c, Displayable d)
{
if(c == submit)
{
String studentName=null ,studentRollNumber=null,studentAge=null;
studentName=name.getString(); /// like this you can get the text entered into the TextField
studentRollNumber=rollNumber.getString(); ///and you can send it to the server
studentAge=age.getString();
Client.startSubmit ();
}
else if(c == cancel)
{
Client.initSession();
}
}
}