Hello,
I have written a code in which back button was working fine but it is not working for some reason also the validation of 2nd form isnt working as well.....plz help

here is the code

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
import java.lang.*;
import javax.microedition.io.*;
import javax.microedition.rms.*;
import com.mgs.util.Encryption;

/**
 * @author abhijeet.p
 */
public class Login extends MIDlet implements CommandListener{

        TextField MMID=null;
	TextField Amount=null;
        TextField PhoneNo=null;
        TextField RMMID=null;
       TextField RAmount=null;
        TextField RPhoneNo=null;
        TextField BMMID=null;
        TextField BMPIN=null;

       // Alert messageAlert;
	Form authForm,mainscreen;
	TextBox t = null;
	StringBuffer b = new StringBuffer();
    private Display myDisplay = null;
    private Command okCommand = new Command("OK", Command.OK, 1);
    private Command exitCommand = new Command("Exit", Command.EXIT, 2);
    private Command backCommand = new Command("Back", Command.BACK, 2);
    private Alert alert = null;


    public Login() {

        myDisplay = Display.getDisplay(this);

	MMID=new TextField("MMID","",7,TextField.NUMERIC);
        Amount=new TextField("Amount","",10,TextField.NUMERIC);
        PhoneNo=new TextField("PhoneNo","",10,TextField.NUMERIC);
	authForm=new Form("Remitter Details");
	mainscreen=new Form("Beneficiary Details");
	//mainscreen.append("Logging in....");
	mainscreen.addCommand(backCommand);
	authForm.append(MMID);
	authForm.append(Amount);
        authForm.append(PhoneNo);
	authForm.addCommand(okCommand);
	authForm.addCommand(exitCommand);
	authForm.setCommandListener(this);
	myDisplay.setCurrent(authForm);

    }
    public void startApp() {
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
    public void commandAction(Command c, Displayable d) {
        if ((c == okCommand) && (d == authForm)) {
	if (MMID.getString().equals("") || MMID.getString().length()<7)
        {
		alert = new Alert("Error", "MMID Should be 7 digits", null, AlertType.ERROR);
		alert.setTimeout(Alert.FOREVER);
		myDisplay.setCurrent(alert);
	}
         else if (Amount.getString().equals(""))
        {
                alert = new Alert("Error", "Enter Amount", null, AlertType.ERROR);
            alert.setTimeout(Alert.FOREVER);
		myDisplay.setCurrent(alert);
        }
        else if (PhoneNo.getString().equals("") || PhoneNo.getString().length()<10)
        {
            alert = new Alert("Error", "PhoneNo Should be 10 digits", null, AlertType.ERROR);
            alert.setTimeout(Alert.FOREVER);
		myDisplay.setCurrent(alert);
        }

        else if ((c == okCommand) && (d == authForm)){
            login();
        }
        }
        else if((c == okCommand) && (d == mainscreen)) {
	if (BMMID.getString().equals("") || BMMID.getString().length()<7)
        {
		alert = new Alert("Error", "MMID Should be 7 digits", null, AlertType.ERROR);
		alert.setTimeout(Alert.FOREVER);
		myDisplay.setCurrent(alert);
	}
        else if (BMPIN.getString().equals("") || BMPIN.getString().length()<7)
        {
            alert = new Alert("Error", "PIN should be 7 digits", null, AlertType.ERROR);
            alert.setTimeout(Alert.FOREVER);
		myDisplay.setCurrent(alert);
        }
        else
        if ((c == backCommand) && (d == mainscreen)) {

                
		myDisplay.setCurrent(authForm);
                mainscreen.deleteAll();
	}
            else if((c == exitCommand) && (d == authForm)) {
		notifyDestroyed();
	}
        else if((c==okCommand)&& (d == mainscreen)){



            connection();

          alert = new Alert  ("Success.", null,null,AlertType.INFO);
          alert.setTimeout(Alert.FOREVER);
          myDisplay.setCurrent(alert);
        }
        
        }

    }
    public void login(){
            String MMID = this.MMID.getString();
            String Amount = this.Amount.getString();
            String PhoneNo = this.PhoneNo.getString();


            CollectionDTO collectionDTO = new CollectionDTO();

            collectionDTO.setMMID(MMID);
            collectionDTO.setAmount(Amount);
            collectionDTO.setPhoneNo(PhoneNo);
            RMMID=new TextField("MMID", collectionDTO.getMMID(), 7, TextField.UNEDITABLE);
            RAmount=new TextField("Amount",collectionDTO.getAmount(),10,TextField.UNEDITABLE);
            RPhoneNo=new TextField("PhoneNo",collectionDTO.getPhoneNo(),10,TextField.UNEDITABLE);
            BMMID =new TextField("MMID","",7,TextField.NUMERIC);
            BMPIN=new TextField("MPIN","",7,TextField.NUMERIC);

            mainscreen.append(RMMID);
            mainscreen.append(RAmount);
            mainscreen.append(RPhoneNo);
            mainscreen.append(BMMID);
            mainscreen.append(BMPIN);
            mainscreen.addCommand(okCommand);
            mainscreen.addCommand(exitCommand);
            mainscreen.setCommandListener(this);
            myDisplay.setCurrent(mainscreen);



    }
    public void connection() {
	HttpConnection connection=null;
	DataInputStream in=null;
        System.out.println("Chene" + RAmount.getString().trim() );

	//String url="http://172.16.50.220:8080/IMPSRemitter/RemitterServlet?RMMID=2e21033e7c3e23f7eaeca9e9bfcd4997eb17ba46c953ae8696a9a2f5e14ce7026dcbe4506c8909892965ed7bd2574f0a95591529b334df31460fd61cfd7740f90872cf418eb93e03399fee0a0ff362daff3fbf1c63e866284a6d5b67884797604defa621f5777cce225030c3f2a827bc04688c8bf3a3804aa744590e8d2a62a89ee2d411811eb60bdece6b3923f24061f8b28aaf57b125e77ac3004e717a6a59eade4f85a3df4150d9c11f70c56219065dbe7879bf02cf3cd001d95ef8b04f3024ca852857e3f9275c4109d99d99ffe0aebd507ed33b184ed90e0cd3a4f0f38780586e74d43dd7223c01a91b50f4f3ba34614fd173141e1cbe72b8db192d38e7";
        String url="http://172.16.50.220:8080/IMPSRemitter/RemitterServlet?RMMID=" + Encryption.encrypt(BMMID.getString().trim()) +
                //"&RMPIN=7110eda4d09e62aa5e4a390b0a572acd2c220"
                 "&BMMID=" + Encryption.encrypt(RMMID.getString().trim()); //+
               /// "&BPhoneNo=" + Encryption.encrypt(RPhoneNo.getString().trim()) ;//+
                //"&TotalAmount=" + Encryption.encrypt(RAmount.getString().trim()) +
        //"&Client=J2ME";

	OutputStream out=null;
	try
	{
		connection=(HttpConnection)Connector.open(url);
		connection.setRequestMethod(HttpConnection.POST);
		connection.setRequestProperty("IF-Modified-Since", "2 Oct 2002 15:10:15 GMT");
	        connection.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
                //connection.setRequestProperty("Content-Length",""+ (MMID.length()+Amount.length()));
//		connection.setRequestProperty("RMMID","2e21033e7c3e23f7eaeca9e9bfcd4997eb17ba46c953ae8696a9a2f5e14ce7026dcbe4506c8909892965ed7bd2574f0a95591529b334df31460fd61cfd7740f90872cf418eb93e03399fee0a0ff362daff3fbf1c63e866284a6d5b67884797604defa621f5777cce225030c3f2a827bc04688c8bf3a3804aa744590e8d2a62a89ee2d411811eb60bdece6b3923f24061f8b28aaf57b125e77ac3004e717a6a59eade4f85a3df4150d9c11f70c56219065dbe7879bf02cf3cd001d95ef8b04f3024ca852857e3f9275c4109d99d99ffe0aebd507ed33b184ed90e0cd3a4f0f38780586e74d43dd7223c01a91b50f4f3ba34614fd173141e1cbe72b8db192d38e7");
//		connection.setRequestProperty("RMPIN","7110eda4d09e62aa5e4a390b0a572acd2c220");
//                connection.setRequestProperty("BMMID","3b19e5a550798401954b8a2b56d204002c6d7f14340a6cf1df5fc59f23495a7608e2d4bbf9e070a203498cefe793c4242444f4e6d8f295b813392749229162da5ec740d6a7c9b430295abc95f10736831f9198ac0b0d31563dcd4c92a313cbdc6cef1fafdae3289c87a6860e18937f87868d65ad330c6b893af69517e401951d0b911e7dd9afc77280bf94e4a3d6de32de3b86b3dee687cc91fe0933eea653133c7e3d0053dc4d5a7abeee12a2bfb8bb3ac0f43a5642b2a6540490ce2061f06569c3f692d8fbda2d497727b8df9bbe9c307def2e9553d50549c4f13f52a19ac805c9e4cc0b6c68ac58666173cbdb006fd1474f6b2eb2e97cbc2d5f23a98c84bc");
//	        connection.setRequestProperty("TotalAmount","69654f5edf716b476c9ae9d23a921d1ff73a4d2a7b87f788cf1bd8f242ebbf56d4f6225fecd109a4318bf6aac24cbe42e2919f8ce581a1d9a425feebc171ed6454edf35a9eed9eb8033df35f9281d4b6c4d0aa7c92a19b523e736e691dd8376a6979f9883fa49258e173b361fe2c6dd08c30eac331f294f5de4dc44192d3bebff212049f88ecb4919b436d5b93173b6780f45f55b342ea4a5977a3d84d212983a0dd49bfd137ff1a3d2f8fed6aaed6584829f290a9ce9d1abb4c1ec019017a8434c229c37376524303935c1b87dd44fcc36568f8c0f2a6cfcb2ec12a6590bee7dd4e3232f896000e4cf47bc592b89f32a3ed5281bb7c9a2576ed83d09882c947");
                out = connection.openDataOutputStream();
	out.flush();
	in = connection.openDataInputStream();
	int ch;
	while((ch = in.read()) != -1) {
		b.append((char) ch);
		//System.out.println((char)ch);
}
t = new TextBox("Reply",b.toString(),1024,0);
	mainscreen.append(b.toString());
	if(in!=null)
		in.close();
	if(out!=null)
		out.close();
	if(connection!=null)
		connection.close();
	}
	catch(IOException x){}

       //myDisplay.setCurrent(mainscreen);

    }
    }

Not working is not much of issue description, don't you think?

Not working is not much of issue description, don't you think?

Sorry about that
not working as in it is disabled.....there is no action on the button...it has just the label no functionality

Sorry about that
not working as in it is disabled.....there is no action on the button...it has just the label no functionality

Solved the problem...thnx :)

Hello,
Can u plz remove the code??
Thanks:)

NO we do not remove code once it is posted. What would be the purpose of this forum that once people got solution to they problem posts would be removed? None.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.