• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help on how to change caption of Confirm box in JSP

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a requirement to change the text of a confirm box displayed to user from "OK" and "CANCEL" to "SAVE" and "DO NOT SAVE"

Can some one please help me with it as I am really new to this.
I am using the javascript to get the OK/CANCEL box butnot sure how to change the caption of it.

Thanks in advance.

Shriya
[ June 18, 2008: Message edited by: Shriya Kishore ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to post HTML and JavaScript questions in the HTML forum. I've moved this there for you,
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't, sorry.

You'll either need to live with the defaults, or make your own confirm box. If you are a beginner, that may be a bit complex for you at the moment.
 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you give me an idea how to create your own custom box.

This is a requirement and I have to get it done.

Please help.

Shriya
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need to use a <div> element, absolutely positioned and z-indexed over the other elements. Style it to look like a mini-dialog perhaps. You'll need to capture and discard events from the rest of the page if you want it to act like a modal dialog. (The easiest way to do that is actually to cover the page with an invisible or translucent div that floats over the page, but under the modal "dialog").
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An example of such a faux modal dialog can be seen at http://www.bibeault.org/blackbox. Click on the "Play the game" button to see the example.
 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will it be right to open a pop up window and make it look like a dialog?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could go that way, but that introduces a whole lot of new issues. You can't make it modal (at least in a cross-browser fashion), it could end up hidden behind the main window, and users could just ignore it. Not to mention the extra complexity of cross-window communications.

Personally, I would not go that route.
 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But I dod not understand your previous suggestion.
Can I find something of that sort on the net.

If you could provide a code snippent,
it will help me immensely.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shriya,
Bear did post a link to the code. It is a lot more complicated than a normal confirm box. Has your user confirmed that they want the requirement even at the cost? Sometimes requirements go away because the user didn't realize how hard they were. After all, changing names doesn't sound tricky unless you are a developer.
 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am afraid yes...
The requirement is very much there and we are just not able to negotiate it.

The link does not have the code.
It merely has the example.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All JavaScript is always available from a site. If you examine the source, you will see that the script files are readily available.

Be aware that BlackBox uses jQuery as a JavaScript library.
 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I do a "view Source" the name of the script is mentioned but it is not downloaded in my temp files.

How can I get hold of the .js file?

Please help.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So in the View Source, you see something like:

You can see the URL of the script file. Just use your browser to hit the URL and download the script.
 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK.
With all your help.
I have successfully opened a pop up window from the main JSP and show 2 buttons for save and cancel.
Now the problem is :
previously the code was :
var str = 'Your query has not been saved. Do you want to save the query?\n' +'\n\tPress "OK" to save the query.' +
'\n\tPress "Cancel" to run the query without saving it.';
if (confirm(str)) {
return saveQuery(executeAfterSave);
}

Now I need to perform the same thing but when save button is clicked in the popup window,i.e on click of save,tehh method in .js file has to be called and the popup should close.
The above code is in .js file.

Please help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic