Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 48
Registered: ‎07-10-2010
My Device: 8300

Disable the prompt for save, discard and cancel.

Hi i have a screen which has an edit field.

Now  i make changes on this edit field.... and do my further processing.

Now i want to go back to my previous screen, so i press the back button,  then it gives me a prompt as SAVE, DISCARD,CANCEL.

I dont want this prompt to come.

How can i disable it.

Developer
Posts: 16,575
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Disable the prompt for save, discard and cancel.

overwrite onsaveprompt to return false

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550

Re: Disable the prompt for save, discard and cancel.

Developer
Posts: 85
Registered: ‎05-03-2010
My Device: Not Specified

Re: Disable the prompt for save, discard and cancel.

If you want to go back using the back button you may want to overwrite the keyChar method and in it check if(ch == Characters.ESCAPE) and pop your current screen. This will work without disabling the prompt.

Contributor
Posts: 16
Registered: ‎01-25-2011
My Device: 9780/9900

Re: Disable the prompt for save, discard and cancel.

I found that this the flowchart on Victor Ewerts blog that explains screen saving flow very succinctly. I think overwriting isDirty is the simplest way to disable the prompt, it also retains the use of the escape button, which overwriting onSavePrompt does not.

 

 

public boolean isDirty() {
	return false;
}

 

 

Contributor
Posts: 44
Registered: ‎06-07-2010
My Device: 9630

Re: Disable the prompt for save, discard and cancel.

Another quick-and-dirty method is to use setDirty(false), but I do agree that overriding isDirty() is probably the more standard approach.

New Contributor
Posts: 4
Registered: ‎03-05-2012
My Device: BlackBerry Curve

Re: Disable the prompt for save, discard and cancel.

Worked for me, thanks!
Developer
Posts: 45
Registered: ‎08-29-2013
My Device: Blackberry curve-9360 and Blackberry bold-9860

Re: Disable the prompt for save, discard and cancel.

Hi,

 

I have tried to play the video in Blackberry BrowserField.

 

The video work fine but it show a prompt of Save, Open and cancel before start palying video.

 

I use isDirty to remove it but it is still displayed.

 

My code is as follow:

 

    VerticalFieldManager VFM = new VerticalFieldManager();
        
    // create new instance of the BrowserField
    BrowserField browserField = new BrowserField();
    browserField.setDirty(false);
   

   // add the browser field to a ui manager or screen
   VFM.add( browserField );
   browserField.requestContent("https://www.gspotrewards.me/videos/HowToUseGSRApp.mp4;interface=wifi");
   add(VFM);

 

 

also used these two methods in this class

 

   public boolean isDirty() {
        System.out.println("----isDirty----");
        return false;
    }
    protected boolean onSavePrompt() {
        System.out.println("---onSave Prompt----");
        return true;
    }

 

but it won't work for me.

 

Please suggest as soon as possible

 

Thanks in advance.

 

 

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Disable the prompt for save, discard and cancel.

[ Edited ]

AFAIK, it is not possible for this prompt to be generated as a result of playing a video.

 

I suggest you create a new project, and in its only screen, add the code you have shown below.  I think you will find that it does not show the problem.  If it does, then let us know.

 

But you should NOT code the connection strng on your browser request anyway, the BrowserField has its own logic to determine which connection to use to download the file.  So remove the ";interface=wifi" - perhaps that will resolve the problem.

Developer
Posts: 45
Registered: ‎08-29-2013
My Device: Blackberry curve-9360 and Blackberry bold-9860

Re: Disable the prompt for save, discard and cancel.

Hi,

 

When you try to open a link directly in Blackberry device browser this display a prompt with Open, Save and Cancel prompt.

 

Similarly when i use BrowserField in my app to play a video it display the similar prompt before start playing.

 

I know this is a default prompt of browser but i want to know is there any way to disable it.

 

Please suggest.

 

Thanks.