pieforms-commit Mailing List for Pieforms
Status: Alpha
Brought to you by:
oracleshinoda
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(73) |
Dec
(83) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(16) |
Feb
(19) |
Mar
(12) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(14) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(45) |
2008 |
Jan
(20) |
Feb
(3) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
(5) |
Jul
(1) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
(7) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
1
(1) |
2
|
3
|
4
|
5
|
6
(3) |
7
(6) |
8
(3) |
9
|
10
(6) |
11
|
12
|
13
|
14
|
15
(6) |
16
|
17
(3) |
18
(3) |
19
|
20
|
21
|
22
|
23
(31) |
24
(8) |
25
(1) |
26
(3) |
27
(9) |
28
|
29
|
30
|
31
|
|
|
|
|
|
|
From: <ora...@us...> - 2006-12-17 23:27:44
|
Revision: 101 http://svn.sourceforge.net/pieforms/?rev=101&view=rev Author: oracleshinoda Date: 2006-12-17 15:27:39 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Use the new, smarter way of putting a message next to the correct submit button Modified Paths: -------------- pieforms-php5/trunk/src/pieform/renderers/table.php Modified: pieforms-php5/trunk/src/pieform/renderers/table.php =================================================================== --- pieforms-php5/trunk/src/pieform/renderers/table.php 2006-12-17 23:26:45 UTC (rev 100) +++ pieforms-php5/trunk/src/pieform/renderers/table.php 2006-12-17 23:27:39 UTC (rev 101) @@ -106,7 +106,7 @@ return "</tbody></table>\n"; } -function pieform_renderer_table_messages_js($id, $submitid) { +function pieform_renderer_table_messages_js($id) { $result = <<<EOF // Given a message and form element name, should set an error on the element function {$id}_set_error(message, element) { @@ -135,7 +135,7 @@ swapDOM(elem, msg); } else { - appendChildNodes($('{$id}_{$submitid}_container').parentNode, msg); + appendChildNodes($('{$id}_' + {$id}_btn + '_container').parentNode, msg); } } function {$id}_remove_message() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-12-17 23:26:46
|
Revision: 100 http://svn.sourceforge.net/pieforms/?rev=100&view=rev Author: oracleshinoda Date: 2006-12-17 15:26:45 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Use the new, smarter way of putting messages next to the correct submit button. Also, use some of the nicer new MochiKit methods to insert divs before/after others Modified Paths: -------------- pieforms-php5/trunk/src/pieform/renderers/div.php Modified: pieforms-php5/trunk/src/pieform/renderers/div.php =================================================================== --- pieforms-php5/trunk/src/pieform/renderers/div.php 2006-12-17 23:24:49 UTC (rev 99) +++ pieforms-php5/trunk/src/pieform/renderers/div.php 2006-12-17 23:26:45 UTC (rev 100) @@ -77,16 +77,18 @@ return $result; } -function pieform_renderer_div_messages_js($id, $submitid) { + +// @todo needs updating again... need to replace remove_error with remove_all_errors +function pieform_renderer_div_messages_js($id) { $result = <<<EOF + // Given a message and form element name, should set an error on the element function {$id}_set_error(message, element) { {$id}_remove_error(element); element += '_container'; // @todo set error class on input elements... - $(element).parentNode.insertBefore(DIV({'id': '{$id}_error_' + element, 'class': 'errmsg'}, message), $(element).nextSibling); + insertSiblingNodesBefore(DIV({'id': '{$id}_error_' + element, 'class': 'errmsg'}, message), $(element)); } -// Given a form element name, should remove an error associated with it function {$id}_remove_error(element) { element += '_container'; var elem = $('{$id}_error_' + element); @@ -95,13 +97,13 @@ } } function {$id}_message(message, type) { - var elem = $('{$id}_message'); - var msg = DIV({'id': '{$id}_message', 'class': type}, message); + var elem = $('{$id}_pieform_message'); + var msg = DIV({'id': '{$id}_pieform_message', 'class': type}, message); if (elem) { swapDOM(elem, msg); } else { - appendChildNodes($('{$submitid}_container').parentNode, msg); + insertSiblingNodesAfter($('{$id}_' + {$id}_btn + '_container'), msg); } } function {$id}_remove_message() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-12-17 23:24:50
|
Revision: 99 http://svn.sourceforge.net/pieforms/?rev=99&view=rev Author: oracleshinoda Date: 2006-12-17 15:24:49 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Be much smarter about which submit button is being sent through in ajax land. This prevents problems with all buttons being sent through and thus causing hiccups with the choice of submit function to call. It also conveniently makes sure that the status messages will always be displayed next to the correct button Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2006-12-15 01:30:15 UTC (rev 98) +++ pieforms-php5/trunk/src/pieform.php 2006-12-17 23:24:49 UTC (rev 99) @@ -889,6 +889,20 @@ // @todo nigel should disable all buttons on this form while the submit is happening $result = <<<EOF +var {$this->name}_btn = null; +// For each submit button, add a waffer thin flag +addLoadEvent(function () { + +EOF; + foreach ($this->get_elements() as $element) { + if (!empty($element['ajaxmessages'])) { + $result .= " connect($('{$this->name}_{$element['name']}'), 'onclick', function () { {$this->name}_btn = '{$element['name']}'; });\n"; + } + } + $result .= <<<EOF + +}); + connect($('{$this->name}'), 'onsubmit', function (e) { // eventually we should check input types for wysiwyg before doing this // Also should only save wysiwyg elements in the form, not all of them... @@ -904,24 +918,23 @@ EOF; // Get values for each element from the form via the DOM foreach ($this->get_elements() as $element) { - if ($element['type'] != 'markup') { - $function = 'pieform_get_value_js_' . $element['type']; - if (function_exists($function)) { - // @todo reverse parameter order for consistency, PieForm first - $result .= $function($element, $this); + // Submit elements will be handled later, as there could be more than one + if (empty($element['ajaxmessages'])) { + if ($element['type'] != 'markup') { + $function = 'pieform_get_value_js_' . $element['type']; + if (function_exists($function)) { + // @todo reverse parameter order for consistency, PieForm first + $result .= $function($element, $this); + } + else { + $result .= " data['" . $element['name'] . "'] = document.forms['$this->name'].elements['{$element['name']}'].value;\n"; + } } - else { - $result .= " data['" . $element['name'] . "'] = document.forms['$this->name'].elements['{$element['name']}'].value;\n"; - } - if (!empty($element['ajaxmessages'])) { - $messageelement = $element['name']; - } } } - if (!isset($messageelement)) { - throw new PieformException('At least one submit-type element is required for AJAX forms'); - } + // Add only the submit button that was clicked + $result .= " data['{$this->name}_' + {$this->name}_btn] = document.forms['$this->name'].elements['{$this->name}_' + {$this->name}_btn].value;\n"; // Add the hidden element for detecting form submission $result .= " data['pieform_{$this->name}'] = '';\n"; @@ -992,7 +1005,7 @@ } } - return $result . $js_messages_function($this->name, $messageelement); + return $result . $js_messages_function($this->name); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |