FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » how to create (open) a dialog box
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
how to create (open) a dialog box [message #175093] Sun, 14 August 2011 10:43 Go to next message
Andre[1] is currently offline  Andre[1]
Messages: 7
Registered: June 2011
Karma: 0
Junior Member
The problem is, I want to ask a user if he really want to delete a record
from a database.
How to do this with a dialog box??
Many tanks in advances
Andre
Re: how to create (open) a dialog box [message #175094 is a reply to message #175093] Sun, 14 August 2011 13:13 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 8/14/2011 6:43 AM, Andre wrote:
> The problem is, I want to ask a user if he really want to delete a record
> from a database.
> How to do this with a dialog box??
> Many tanks in advances
> Andre

PHP is server-side. Dialog boxes are client-side. You can't do it in PHP.

You can do it in javascript - try comp.lang.javascript. You can even do
something close in HTML, but it's much harder.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: how to create (open) a dialog box [message #175095 is a reply to message #175093] Sun, 14 August 2011 16:18 Go to previous messageGo to next message
Robert Hairgrove is currently offline  Robert Hairgrove
Messages: 19
Registered: September 2010
Karma: 0
Junior Member
On 08/14/2011 12:43 PM, Andre wrote:
> The problem is, I want to ask a user if he really want to delete a record
> from a database.
> How to do this with a dialog box??
> Many tanks in advances
> Andre

This is a job for JavaScript in your browser. PHP doesn't have dialog
boxes because it runs on the server, not on the client.
Re: how to create (open) a dialog box [message #175096 is a reply to message #175095] Sun, 14 August 2011 18:59 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Robert Hairgrove wrote:

> Andre wrote:
>> The problem is, I want to ask a user if he really want to delete a record
>> from a database.
>> How to do this with a dialog box??
>
> This is a job for JavaScript in your browser.

Not necessarily.

> PHP doesn't have dialog boxes because it runs on the server, not on the
> client.

Wrong, but the question is probably off-topic here regardless.

<http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Re: how to create (open) a dialog box [message #175101 is a reply to message #175093] Mon, 15 August 2011 12:39 Go to previous messageGo to next message
Andre[1] is currently offline  Andre[1]
Messages: 7
Registered: June 2011
Karma: 0
Junior Member
Le Sun, 14 Aug 2011 10:43:21 +0000, Andre a écrit :

> The problem is, I want to ask a user if he really want to delete a
> record from a database.
> How to do this with a dialog box??
> Many tanks in advances
> Andre

Many thanks to every body.
Very instersting, particalary the freebook site.
Andre
Re: how to create (open) a dialog box [message #175103 is a reply to message #175096] Mon, 15 August 2011 12:48 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
> Robert Hairgrove wrote:
>
>> Andre wrote:
>>> The problem is, I want to ask a user if he really want to delete a record
>>> from a database.
>>> How to do this with a dialog box??
>>
>> This is a job for JavaScript in your browser.
>
> Not necessarily.
>
>> PHP doesn't have dialog boxes because it runs on the server, not on the
>> client.
>
> Wrong, but the question is probably off-topic here regardless.
>

Please identify which browsers implement PHP. But you can't - because
you're wrong - as usual.

> <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>
>
>
> PointedEars



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: how to create (open) a dialog box [message #175105 is a reply to message #175103] Mon, 15 August 2011 17:12 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <j2b4iv$agc$2(at)dont-email(dot)me>,
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

> On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
>> Robert Hairgrove wrote:
>>
>>> Andre wrote:
>>>> The problem is, I want to ask a user if he really want to delete a record
>>>> from a database.
>>>> How to do this with a dialog box??
>>>
>>> This is a job for JavaScript in your browser.
>>
>> Not necessarily.
>>
>>> PHP doesn't have dialog boxes because it runs on the server, not on the
>>> client.
>>
>> Wrong, but the question is probably off-topic here regardless.
>>
>
> Please identify which browsers implement PHP. But you can't - because
> you're wrong - as usual.
>
>> <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>

Ah, the PHP-GTK stuff. I'd be happy if that worked well and was
available. But it's more than a years since the website was even updated
- and that was a comment a year after a comment that was itself a year
after any software was last released. And that had nothing for OS X in
which case <raspberry> to it.

So for all practical purposes PHP runs in the server, or possibly on
your machine at the command line.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: how to create (open) a dialog box [message #175106 is a reply to message #175105] Mon, 15 August 2011 17:31 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 8/15/2011 1:12 PM, Tim Streater wrote:
> In article <j2b4iv$agc$2(at)dont-email(dot)me>,
> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>
>> On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
>>> Robert Hairgrove wrote:
>>>
>>>> Andre wrote:
>>>> > The problem is, I want to ask a user if he really want to delete a
>> record
>>>> > from a database.
>>>> > How to do this with a dialog box??
>>>>
>>>> This is a job for JavaScript in your browser.
>>>
>>> Not necessarily.
>>>
>>>> PHP doesn't have dialog boxes because it runs on the server, not on
>> the
>>>> client.
>>>
>>> Wrong, but the question is probably off-topic here regardless.
>>>
>>
>> Please identify which browsers implement PHP. But you can't - because
>> you're wrong - as usual.
>>
>>> <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>
>
> Ah, the PHP-GTK stuff. I'd be happy if that worked well and was
> available. But it's more than a years since the website was even updated
> - and that was a comment a year after a comment that was itself a year
> after any software was last released. And that had nothing for OS X in
> which case <raspberry> to it.
>
> So for all practical purposes PHP runs in the server, or possibly on
> your machine at the command line.
>

Tim, GTK is not a browser. I'd still like to see "Pointed Head" tell me
which browsers implement PHP.

And please not I didn't indicate PHP can't run as a CLI on a client
machine. I specifically asked about browsers.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: how to create (open) a dialog box [message #175107 is a reply to message #175106] Mon, 15 August 2011 18:13 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <j2bl6g$qlj$1(at)dont-email(dot)me>,
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

> On 8/15/2011 1:12 PM, Tim Streater wrote:
>> In article <j2b4iv$agc$2(at)dont-email(dot)me>,
>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>
>>> On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
>>>> Robert Hairgrove wrote:
>>>>
>>>> > Andre wrote:
>>>> >> The problem is, I want to ask a user if he really want to delete a
>>> record
>>>> >> from a database.
>>>> >> How to do this with a dialog box??
>>>> >
>>>> > This is a job for JavaScript in your browser.
>>>>
>>>> Not necessarily.
>>>>
>>>> > PHP doesn't have dialog boxes because it runs on the server, not on
>>> the
>>>> > client.
>>>>
>>>> Wrong, but the question is probably off-topic here regardless.

>>> Please identify which browsers implement PHP. But you can't - because
>>> you're wrong - as usual.
>>>
>>>> <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>
>>
>> Ah, the PHP-GTK stuff. I'd be happy if that worked well and was
>> available. But it's more than a years since the website was even updated
>> - and that was a comment a year after a comment that was itself a year
>> after any software was last released. And that had nothing for OS X in
>> which case <raspberry> to it.
>>
>> So for all practical purposes PHP runs in the server, or possibly on
>> your machine at the command line.

> Tim, GTK is not a browser. I'd still like to see "Pointed Head" tell me
> which browsers implement PHP.
>
> And please note I didn't indicate PHP can't run as a CLI on a client
> machine. I specifically asked about browsers.

:-)

Indeed. I just came in at the end.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: how to create (open) a dialog box [message #175109 is a reply to message #175101] Mon, 15 August 2011 18:18 Go to previous messageGo to next message
A.Reader is currently offline  A.Reader
Messages: 15
Registered: December 2010
Karma: 0
Junior Member
On 15 Aug 2011 12:39:32 GMT,
Andre <pas(at)pourmois(dot)be> wrote:

> Le Sun, 14 Aug 2011 10:43:21 +0000, Andre a écrit :
>
>> The problem is, I want to ask a user if he really want to delete a
>> record from a database.
>> How to do this with a dialog box??
>> Many tanks in advances
>> Andre
>
> Many thanks to every body.
> Very instersting, particalary the freebook site.
> Andre

Andre, one way to avoid having to ask whether the person wants to
delete the record is to make deleting it a 2- or 3-action
process.

For example, you might require that they check 2 checkboxes and
click a button. A person might accidently check one box and
click the button, but it's quite unlikely that they'll check
_both_ boxes for the same record by mistake.
Re: how to create (open) a dialog box [message #175110 is a reply to message #175103] Mon, 15 August 2011 19:07 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Jerry Stuckle wrote:

> On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
>> Robert Hairgrove wrote:
>>> PHP doesn't have dialog boxes because it runs on the server, not on the
>>> client.
>> Wrong, but the question is probably off-topic here regardless.
>
> Please identify which browsers implement PHP

Fallacy: Raising the bar.

> But you can't - because you're wrong - as usual.

Fallacy: Argumentum ad hominem.

>> <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>

You haven't read that, have you?


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
Re: how to create (open) a dialog box [message #175111 is a reply to message #175110] Mon, 15 August 2011 21:19 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 8/15/2011 3:07 PM, Thomas 'PointedEars' Lahn wrote:
> Jerry Stuckle wrote:
>
>> On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
>>> Robert Hairgrove wrote:
>>>> PHP doesn't have dialog boxes because it runs on the server, not on the
>>>> client.
>>> Wrong, but the question is probably off-topic here regardless.
>>
>> Please identify which browsers implement PHP
>
> Fallacy: Raising the bar.
>

Not at all. We are talking client-server here.

>> But you can't - because you're wrong - as usual.
>
> Fallacy: Argumentum ad hominem.
>

Nope, the truth.

>>> <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>
>
> You haven't read that, have you?
>
>
> PointedEars

Don't need to. Unlike you, I know what I'm talking about. But that's
normal for you - your trolling has made you persona non grata in several
newsgroups.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: how to create (open) a dialog box [message #175112 is a reply to message #175109] Tue, 16 August 2011 00:50 Go to previous messageGo to next message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma: 0
Senior Member
On 8/15/2011 2:18 PM, A.Reader wrote:
> On 15 Aug 2011 12:39:32 GMT,
> Andre<pas(at)pourmois(dot)be> wrote:
>
>> Le Sun, 14 Aug 2011 10:43:21 +0000, Andre a écrit :
>>
>>> The problem is, I want to ask a user if he really want to delete a
>>> record from a database.
>>> How to do this with a dialog box??
>>> Many tanks in advances
>>> Andre
>>
>> Many thanks to every body.
>> Very instersting, particalary the freebook site.
>> Andre
>
> Andre, one way to avoid having to ask whether the person wants to
> delete the record is to make deleting it a 2- or 3-action
> process.
>
> For example, you might require that they check 2 checkboxes and
> click a button. A person might accidently check one box and
> click the button, but it's quite unlikely that they'll check
> _both_ boxes for the same record by mistake.

.....or simply use an onClick to have a confirm message box pop up.

--
Shelly
Re: how to create (open) a dialog box [message #175117 is a reply to message #175112] Tue, 16 August 2011 06:21 Go to previous messageGo to next message
Robert Hairgrove is currently offline  Robert Hairgrove
Messages: 19
Registered: September 2010
Karma: 0
Junior Member
On 08/16/2011 02:50 AM, sheldonlg wrote:
> On 8/15/2011 2:18 PM, A.Reader wrote:
>> On 15 Aug 2011 12:39:32 GMT,
>> Andre<pas(at)pourmois(dot)be> wrote:
>>
>>> Le Sun, 14 Aug 2011 10:43:21 +0000, Andre a écrit :
>>>
>>>> The problem is, I want to ask a user if he really want to delete a
>>>> record from a database.
>>>> How to do this with a dialog box??
>>>> Many tanks in advances
>>>> Andre
>>>
>>> Many thanks to every body.
>>> Very instersting, particalary the freebook site.
>>> Andre
>>
>> Andre, one way to avoid having to ask whether the person wants to
>> delete the record is to make deleting it a 2- or 3-action
>> process.
>>
>> For example, you might require that they check 2 checkboxes and
>> click a button. A person might accidently check one box and
>> click the button, but it's quite unlikely that they'll check
>> _both_ boxes for the same record by mistake.
>
> ....or simply use an onClick to have a confirm message box pop up.
>

Exactly! And this is done in web applications using a client scripting
language (such as JavaScript, not PHP).

Whether or not PHP can run on the client in specialized environments is
irrelevant. In most cases, it does run on the server and cannot generate
confirmation dialog boxes.
Re: how to create (open) a dialog box [message #175133 is a reply to message #175111] Tue, 16 August 2011 16:47 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Jerry Stuckle wrote:

> On 8/15/2011 3:07 PM, Thomas 'PointedEars' Lahn wrote:
>> Jerry Stuckle wrote:
>>> On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
>>>> Robert Hairgrove wrote:
>>>> > PHP doesn't have dialog boxes because it runs on the server, not on
>>>> > the client.
>>>> Wrong, but the question is probably off-topic here regardless.
>>> Please identify which browsers implement PHP
>>
>> Fallacy: Raising the bar.
>
> Not at all. We are talking client-server here.

There is exactly nothing in the OP to suggest that. In fact, it might very
well be possible that the OP was indeed working on client-side code. You
might also want to notice that they were grateful especially for that link:

>>>> <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>
>>
>> You haven't read that, have you?
>
> Don't need to. Unlike you, I know what I'm talking about.

No, you don't. You are assuming things and you think that your assumptions
are the only viable interpretation. They are not.

> [ad hominem]

You can't help it, yes?


POintedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
Re: how to create (open) a dialog box [message #175134 is a reply to message #175117] Tue, 16 August 2011 17:03 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Robert Hairgrove wrote:

> On 08/16/2011 02:50 AM, sheldonlg wrote:
>> On 8/15/2011 2:18 PM, A.Reader wrote:
>>> Andre, one way to avoid having to ask whether the person wants to
>>> delete the record is to make deleting it a 2- or 3-action
>>> process.
>>>
>>> For example, you might require that they check 2 checkboxes and
>>> click a button. A person might accidently check one box and
>>> click the button, but it's quite unlikely that they'll check
>>> _both_ boxes for the same record by mistake.
>>
>> ....or simply use an onClick to have a confirm message box pop up.

For the reasons detailed below, `onClick' (or `onclick' in XHTML) is the
wrong event-handler attribute (and `click' is the wrong event) to use here.

> Exactly! And this is done in web applications using a client scripting
> language (such as JavaScript, not PHP).

You are still wrong about which language can be used where, and you really
do not know what JavaScript is.

However, more important to notice is that the drawback of a client-side only
solution in the client-server model – assuming this is the case here – is
that – rather obviously – it does not work without client-side support.
There is the NoScript extension, for example, to prevent client-side scripts
from running, as many people have used client-side scripting for rather
dubious purposes.

The client-side dialog – in fact, any client-side code – should augment a
server-side generated solution (to reduce the number of roundtrips to the
server, thus enhancing user experience and reducing server/network load);
with few exceptions, it should not replace it. This can be done easily, for
example:

<form action="delete-dialog.php"
onsubmit="return window.confirm('Delete?')">
<input type="submit" value="Delete">
</form>

The best solution regarding this approach is a server-side framework which
provides the classes to generate the forms (here: both for submitting the
deletion request and confirming it) and the client-side code, so that the
data only needs to be maintained in one place.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Re: how to create (open) a dialog box [message #175136 is a reply to message #175134] Tue, 16 August 2011 20:02 Go to previous messageGo to next message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma: 0
Senior Member
On 8/16/2011 1:03 PM, Thomas 'PointedEars' Lahn wrote:
> Robert Hairgrove wrote:
>
>> On 08/16/2011 02:50 AM, sheldonlg wrote:
>>> On 8/15/2011 2:18 PM, A.Reader wrote:
>>>> Andre, one way to avoid having to ask whether the person wants to
>>>> delete the record is to make deleting it a 2- or 3-action
>>>> process.
>>>>
>>>> For example, you might require that they check 2 checkboxes and
>>>> click a button. A person might accidently check one box and
>>>> click the button, but it's quite unlikely that they'll check
>>>> _both_ boxes for the same record by mistake.
>>>
>>> ....or simply use an onClick to have a confirm message box pop up.
>
> For the reasons detailed below, `onClick' (or `onclick' in XHTML) is the
> wrong event-handler attribute (and `click' is the wrong event) to use here.
>
>> Exactly! And this is done in web applications using a client scripting
>> language (such as JavaScript, not PHP).
>
> You are still wrong about which language can be used where, and you really
> do not know what JavaScript is.
>
> However, more important to notice is that the drawback of a client-side only
> solution in the client-server model – assuming this is the case here – is
> that – rather obviously – it does not work without client-side support.
> There is the NoScript extension, for example, to prevent client-side scripts
> from running, as many people have used client-side scripting for rather
> dubious purposes.
>
> The client-side dialog – in fact, any client-side code – should augment a
> server-side generated solution (to reduce the number of roundtrips to the
> server, thus enhancing user experience and reducing server/network load);
> with few exceptions, it should not replace it. This can be done easily, for
> example:
>
> <form action="delete-dialog.php"
> onsubmit="return window.confirm('Delete?')">
> <input type="submit" value="Delete">
> </form>
>
> The best solution regarding this approach is a server-side framework which
> provides the classes to generate the forms (here: both for submitting the
> deletion request and confirming it) and the client-side code, so that the
> data only needs to be maintained in one place.
>
>
> PointedEars

Wouldn't you use onsubmit only if you are submitting the entire page?
The onclick allows you to confirm the deletion, send off an AJAX
request, and still stay on the page.

--
Shelly
Re: how to create (open) a dialog box [message #175137 is a reply to message #175136] Tue, 16 August 2011 20:13 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <j2eio6$mer$1(at)dont-email(dot)me>,
sheldonlg <sheldonlg(at)thevillages(dot)net> wrote:

> Wouldn't you use onsubmit only if you are submitting the entire page?
> The onclick allows you to confirm the deletion, send off an AJAX
> request, and still stay on the page.

Yes. In my app I never submit any forms at all. Everything happens via
onclick events and ajax.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: how to create (open) a dialog box [message #175142 is a reply to message #175136] Tue, 16 August 2011 21:11 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
sheldonlg wrote:

> On 8/16/2011 1:03 PM, Thomas 'PointedEars' Lahn wrote:
>> The client-side dialog – in fact, any client-side code – should augment a
>> server-side generated solution (to reduce the number of roundtrips to the
>> server, thus enhancing user experience and reducing server/network load);
>> with few exceptions, it should not replace it. This can be done easily,
>> for example:
>>
>> <form action="delete-dialog.php"
>> onsubmit="return window.confirm('Delete?')">
>> <input type="submit" value="Delete">
>> </form>
>>
>> The best solution regarding this approach is a server-side framework
>> which provides the classes to generate the forms (here: both for
>> submitting the deletion request and confirming it) and the client-side
>> code, so that the data only needs to be maintained in one place.
>
> Wouldn't you use onsubmit only if you are submitting the entire page?
> The onclick allows you to confirm the deletion, send off an AJAX
> request, and still stay on the page.

You need to be more precise with your terminology. There are no pages, in
particular not with server-side programming.

An (X)HTML document (as it can also be generated by a server-side script)
can contain more than one form, and they can be submitted separatedly.
Also, the target of a form submission can be – in HTML 4.01 Transitional or
XHTML 1.0 Transitional, or in XHTML 1.x with a user-defined DTD, to satisfy
validity constraints – another window (an iframe, a frame, or a tab), in
which case the document in the form's viewport would not change.

In this case, change is the purpose of the form, though. One *wants* to
display a document with a delete confirmation dialog *even if* the client-
side dialog *cannot* be displayed.

If the client-side dialog cannot be displayed (which is the premise of my
suggestion), then "AJAX" would not work either (keep in mind that the term
is not exactly a misnomer in the only regard that the "J" stands for
"JavaScript".)

However, my example is flawed as it is – due to oversimplification –
incomplete: If you would confirm the client-side dialog, the server-side
confirmation dialog would be displayed regardless.

A fix would be to set the submitted value of an `input' element to a certain
different value before submission so that the server side would not generate
the confirmation dialog again, e.g.:

<script type="text/javascript">
function confirmDelete(form)
{
if (window.confirm("Delete this item?"))
{
form.elements["confirmed"].value = "1";
return true;
}

return false;
}
</script>

<form action="delete-dialog.php"
onsubmit="return confirmDelete(this)"
method="POST">
<input type="hidden" name="confirmed" value="0">
<input type="submit" value="Delete">
</form>

Then, on the server-side, e.g.:

<?php
if ($_POST['confirmed'] !== '1')
{
/* this part should be done dynamically by the mentioned framework */
?>
<form action="delete-dialog.php"
method="POST">
<div>
<input type="hidden" name="confirmed" value="1">
<span>Delete this item?</span>
<input type="submit" value="Delete">
</div>
</form>
<?php
}
else
{
/* proceed with deletion */
}
?>

(I am using POST, and not GET, here so that one is less likely to cause
deletion accidentally when navigating the history. A good browser would ask
the user before submitting POST data again.)

More sophisticated approaches include using XHR (colloquially and falsely
called "AJAX") to request, retrieve and display a server generated
confirmation dialog instead of the rather crude, built-in one (BTDT). But
AISB, this would not work without client-side scripting, so it can be safely
excluded as a *fallback* for a server-side solution.


HTH

PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Re: how to create (open) a dialog box [message #175143 is a reply to message #175142] Tue, 16 August 2011 21:15 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Thomas 'PointedEars' Lahn wrote:

> More sophisticated approaches include using XHR (colloquially and falsely
> called "AJAX") to request, retrieve and display a server generated
> confirmation dialog instead of the rather crude, built-in one (BTDT). But
> AISB, this would not work without client-side scripting, so it can be
> safely excluded as a *fallback* for a server-side solution.
^^^^^^^^^^^^^^^^^^^^^^
Err, that's _client-side (traditional) solution_ (window.confirm), of
course.

--
PointedEars
Re: how to create (open) a dialog box [message #175144 is a reply to message #175137] Tue, 16 August 2011 21:16 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Tim Streater wrote:

> sheldonlg <sheldonlg(at)thevillages(dot)net> wrote:
>> Wouldn't you use onsubmit only if you are submitting the entire page?
>> The onclick allows you to confirm the deletion, send off an AJAX
>> request, and still stay on the page.
>
> Yes. In my app I never submit any forms at all. Everything happens via
> onclick events and ajax.

IOW, your app cannot be used without client-side scripting, as "ajax"
requires that. With few exceptions, I would consider that bad software
design.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
Re: how to create (open) a dialog box [message #175147 is a reply to message #175144] Tue, 16 August 2011 21:25 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <4033706(dot)4JQzZI6eRS(at)PointedEars(dot)de>,
Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote:

> Tim Streater wrote:
>
>> sheldonlg <sheldonlg(at)thevillages(dot)net> wrote:
>>> Wouldn't you use onsubmit only if you are submitting the entire page?
>>> The onclick allows you to confirm the deletion, send off an AJAX
>>> request, and still stay on the page.
>>
>> Yes. In my app I never submit any forms at all. Everything happens via
>> onclick events and ajax.
>
> IOW, your app cannot be used without client-side scripting, as "ajax"
> requires that. With few exceptions, I would consider that bad software
> design.

So what should I replace my 15000 lines of javaScript with then? Magic?

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: how to create (open) a dialog box [message #175153 is a reply to message #175133] Tue, 16 August 2011 23:47 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 8/16/2011 12:47 PM, Thomas 'PointedEars' Lahn wrote:
> Jerry Stuckle wrote:
>
>> On 8/15/2011 3:07 PM, Thomas 'PointedEars' Lahn wrote:
>>> Jerry Stuckle wrote:
>>>> On 8/14/2011 2:59 PM, Thomas 'PointedEars' Lahn wrote:
>>>> > Robert Hairgrove wrote:
>>>> >> PHP doesn't have dialog boxes because it runs on the server, not on
>>>> >> the client.
>>>> > Wrong, but the question is probably off-topic here regardless.
>>>> Please identify which browsers implement PHP
>>>
>>> Fallacy: Raising the bar.
>>
>> Not at all. We are talking client-server here.
>
> There is exactly nothing in the OP to suggest that. In fact, it might very
> well be possible that the OP was indeed working on client-side code. You
> might also want to notice that they were grateful especially for that link:
>

That is hilarious (it means "very funny"). Everyone else who answered
the question understood that. But not "Pointed Head".

>>>> > <http://www.freeopenbook.com/phpcookbook/phpckbk-chp-20.html>
>>>
>>> You haven't read that, have you?
>>
>> Don't need to. Unlike you, I know what I'm talking about.
>
> No, you don't. You are assuming things and you think that your assumptions
> are the only viable interpretation. They are not.
>
>> [ad hominem]
>
> You can't help it, yes?
>
>
> POintedEars

Just calling a spade a spade. Or, in your case, calling a stoopid troll
a stoopid troll - just like you've been called in so many newsgroups.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: how to create (open) a dialog box [message #175156 is a reply to message #175147] Wed, 17 August 2011 18:31 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Tim Streater wrote:

> Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote:
>> Tim Streater wrote:
>>> sheldonlg <sheldonlg(at)thevillages(dot)net> wrote:
>>>> Wouldn't you use onsubmit only if you are submitting the entire page?
>>>> The onclick allows you to confirm the deletion, send off an AJAX
>>>> request, and still stay on the page.
>>>
>>> Yes. In my app I never submit any forms at all. Everything happens via
>>> onclick events and ajax.
>> IOW, your app cannot be used without client-side scripting, as "ajax"
>> requires that. With few exceptions, I would consider that bad software
>> design.
>
> So what should I replace my 15000 lines of javaScript with then? Magic?

You should rewrite your application so that it works with and without
client-side scripting. That design approach is called graceful degradation.
It is not hard to do (see my example) if you start from the premise that
client-side scripting is not available, instead of the opposite. And 15000
LOCs is probably too much client-side script code. You might want to ask
questions about parts of your code where it is on-topic.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
Re: how to create (open) a dialog box [message #175157 is a reply to message #175156] Wed, 17 August 2011 20:50 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <8880046(dot)SEqChMirdb(at)PointedEars(dot)de>,
Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote:

> Tim Streater wrote:
>
>> Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote:
>>> Tim Streater wrote:
>>>> sheldonlg <sheldonlg(at)thevillages(dot)net> wrote:
>>>> > Wouldn't you use onsubmit only if you are submitting the entire page?
>>>> > The onclick allows you to confirm the deletion, send off an AJAX
>>>> > request, and still stay on the page.
>>>>
>>>> Yes. In my app I never submit any forms at all. Everything happens via
>>>> onclick events and ajax.
>>> IOW, your app cannot be used without client-side scripting, as "ajax"
>>> requires that. With few exceptions, I would consider that bad software
>>> design.
>>
>> So what should I replace my 15000 lines of javaScript with then? Magic?
>
> You should rewrite your application so that it works with and without
> client-side scripting.

No I don't. This app requires JavaScript to be enabled in order to run.
Y'know, like most applications have a minimum configuration requirement?
Well this is one of those.

> That design approach is called graceful degradation.

So apps should be designed so they still run if someone removes the
processor from the computer? Were you always this mad?

> It is not hard to do (see my example) if you start from the premise that
> client-side scripting is not available, instead of the opposite. And 15000
> LOCs is probably too much client-side script code. You might want to ask
> questions about parts of your code where it is on-topic.

I don't need to ask any questions at this time about my code, you rude
bastard. I expect it could be done with little or no JavaScript, but it
would be piss-poor experience for the user.

Now fuck off and take your shitty useless advice with you.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: how to create (open) a dialog box [message #175159 is a reply to message #175157] Thu, 18 August 2011 01:06 Go to previous messageGo to next message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma: 0
Senior Member
On 8/17/2011 4:50 PM, Tim Streater wrote:
> In article <8880046(dot)SEqChMirdb(at)PointedEars(dot)de>,
> Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote:

>> That design approach is called graceful degradation.
>
> So apps should be designed so they still run if someone removes the
> processor from the computer? Were you always this mad?

His basis is that you want to reach as many people as possible and a
certain percentage of them will turn off javascript. Now I ask, what is
that percentage? If you are selling something, how much added revenue
would be gained from having that percentage reach you versus the added
costs for writing AND DEBUGGING AND MAINTAINING a dual system.

Putting into google "percentage of people who turn off javascript" we
get from the very first link:

"According to data collected in 2007, 1.04% have it disabled in the EU,
and 3.05% have it disabled in the US."

So, between one and three percent turn off javascript. I call that no
BFD. I'll put a message in the script for the "page" that javascript is
required for this "page". It just doesn't pass the cost/benefit analysis.

(I, myself, am in the 97% of the US users).

--
Shelly
Re: how to create (open) a dialog box [message #175163 is a reply to message #175159] Thu, 18 August 2011 15:13 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(sheldonlg)

> Putting into google "percentage of people who turn off javascript" we
> get from the very first link:
>
> "According to data collected in 2007, 1.04% have it disabled in the EU,
> and 3.05% have it disabled in the US."

Such global "statistics" are completely useless. What matters are your
own stats from your own website, nothing else.

> So, between one and three percent turn off javascript.

On one of the sites I maintan it's 8.5% for the current month and 12.6%
for the entire year until today. We're in the EU.

Micha

--
http://mfesser.de/blickwinkel
Re: how to create (open) a dialog box [message #175168 is a reply to message #175163] Thu, 18 August 2011 17:37 Go to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <klaq47duigbittnsusdng3cep8625hl7np(at)mfesser(dot)de>,
Michael Fesser <netizen(at)gmx(dot)de> wrote:

> .oO(sheldonlg)
>
>> Putting into google "percentage of people who turn off javascript" we
>> get from the very first link:
>>
>> "According to data collected in 2007, 1.04% have it disabled in the EU,
>> and 3.05% have it disabled in the US."
>
> Such global "statistics" are completely useless. What matters are your
> own stats from your own website, nothing else.

In my case, there is no "website", and so the stats are meaningless
anyway, although I appreciate what Shelly was doing. In my case, a
browser with JavaScript (I choose to use Safari), apache, a number of
PHP scripts, and SQLite are the components of my application. These all
come free under OS X, and since its the only platform I have and have an
interest in, that is the platform it runs on. To run it, the user
double-clicks an application icon just as they do with any app.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: xml search using javascript
Next Topic: Freelance PHP Developer
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 18:50:19 GMT 2024

Total time taken to generate the page: 0.02379 seconds