PDA

View Full Version : confirm buttons -beyond 'OK' & 'Cancel'



fuzzy1
Jan 23rd, 2007, 10:16 PM
Hey All,
I've found articles/posts on creating custom confirm pops utilizing hidden <div> etc,
but adding 40 odd lines of code just to offer Yes or No buttons seems absurd.
Short of creating a complete confirmation div and script, is it possible
to EASILY change the button values of a confirmation pop-up?
For Example,
"There is a related value not selected in the form.
Would you like to select it now?"

Yes No

In this context, 'Cancel' conveys a completely inappropriate meaning.
Anyone?

Philip M
Jan 24th, 2007, 08:27 AM
Short of creating a complete confirmation div and script, is it possible
to EASILY change the button values of a confirmation pop-up?
For Example,
"There is a related value not selected in the form.
Would you like to select it now?"

Yes No

In this context, 'Cancel' conveys a completely inappropriate meaning.
Anyone?

No, it is not possible.

felgall
Jan 25th, 2007, 02:39 AM
Hey All,
I've found articles/posts on creating custom confirm pops utilizing hidden <div> etc,
but adding 40 odd lines of code just to offer Yes or No buttons seems absurd.
Short of creating a complete confirmation div and script, is it possible
to EASILY change the button values of a confirmation pop-up?
For Example,
"There is a related value not selected in the form.
Would you like to select it now?"

Yes No

In this context, 'Cancel' conveys a completely inappropriate meaning.
Anyone?


The only other option (apart from generating it within the page yourself) would be to write your own browser and then add your own proprietary add-on to the Javascript processor that you build into the browser to handle it. Once you have finished writing the hundreds of thousands of line of code needed then you just need to convince everyone to dump their current browser and use yours instead.

tonyp12
Jan 25th, 2007, 03:27 AM
I you have no problem with using IE only.

window.showModalDialog()

http://www.google.com/search (http://www.google.com/search?hl=en&q=window.showModalDialog%28%29&btnG=Google+Search)

david_kw
Jan 25th, 2007, 03:59 AM
but adding 40 odd lines of code just to offer Yes or No buttons seems absurd.


I suspect 40 lines of code is nothing nowadays in terms of javascript web applications. If you really need yes/no you can roll your own. And extra 1k bytes of space for a web page that uses it won't be an issue in my mind.

david_kw

tonyp12
Jan 29th, 2007, 05:06 AM
I put this simple example together

There are also 'block' and 'none' to hide divs

or you could avoid div and just hide the buttons directly
<button id="yesbutton" onclick="doit()" style="VISIBILITY:hidden">Yes</button>



<html>
<head>
<title>hidden div</title>

<script>
function showbutton(d)
{
document.getElementById("askyesno").style.visibility= d ? "visible" : "hidden"
}

</script>
</head>
<body>
<button onclick="showbutton(true)">show</button>
<button onclick="showbutton(false)">hide</button>

<div id="askyesno" style="VISIBILITY:hidden">
<button onclick="do my yes duty">Yes</button>
<button onclick="no it is">No</button></div>
</body>
</html>