[Pieforms-commit] SF.net SVN: pieforms: [285] pieforms-php5/trunk/src/pieform/elements/cancel .php
Status: Alpha
Brought to you by:
oracleshinoda
From: <ora...@us...> - 2008-01-29 04:26:06
|
Revision: 285 http://pieforms.svn.sourceforge.net/pieforms/?rev=285&view=rev Author: oracleshinoda Date: 2008-01-28 20:26:11 -0800 (Mon, 28 Jan 2008) Log Message: ----------- Add support for confirming a cancel button. Thanks to Clare Lenihan. Modified Paths: -------------- pieforms-php5/trunk/src/pieform/elements/cancel.php Modified: pieforms-php5/trunk/src/pieform/elements/cancel.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/cancel.php 2008-01-29 04:25:39 UTC (rev 284) +++ pieforms-php5/trunk/src/pieform/elements/cancel.php 2008-01-29 04:26:11 UTC (rev 285) @@ -38,6 +38,10 @@ throw new PieformException('Cancel elements must have a value'); } + if (isset($element['confirm'])) { + $element['onclick'] = 'return confirm(' . json_encode($element['confirm']) . ');'; + } + $attributes = $form->element_attributes($element); $attributes = preg_replace('/name="(.*)"/', 'name="cancel_$1"', $attributes); $attributes = preg_replace('/id="(.*)"/', 'id="cancel_$1"', $attributes); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |