[Phphtmllib-devel] SF.net SVN: phphtmllib:[3150] branches/BRANCH_2_X/phphtmllib/widgets/ data_list/
Status: Beta
Brought to you by:
hemna
From: <mpw...@us...> - 2008-09-02 03:16:25
|
Revision: 3150 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3150&view=rev Author: mpwalsh8 Date: 2008-09-02 03:16:35 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Added Javascript to action_select to allow form submit. Modified Paths: -------------- branches/BRANCH_2_X/phphtmllib/widgets/data_list/DefaultGUIDataList.inc Modified: branches/BRANCH_2_X/phphtmllib/widgets/data_list/DefaultGUIDataList.inc =================================================================== --- branches/BRANCH_2_X/phphtmllib/widgets/data_list/DefaultGUIDataList.inc 2008-08-31 11:36:37 UTC (rev 3149) +++ branches/BRANCH_2_X/phphtmllib/widgets/data_list/DefaultGUIDataList.inc 2008-09-02 03:16:35 UTC (rev 3150) @@ -1,4 +1,5 @@ <?php +/* vim: set expandtab tabstop=4 shiftwidth=4: */ /** * * This file contains the Default DataList child @@ -1143,8 +1144,8 @@ * @param string - extra js to put prior to the submit(); * @return INPUTtag object */ - function action_button($name, $action = "", $javascript = "") { - + function action_button($name, $action = "", $javascript = "") + { $submit = form_submit("_action", $name); // here we make sure that all standard buttons look the same @@ -1183,12 +1184,30 @@ * @return INPUTtag object */ function action_select($name, $options = array(), - $selected = "", $multiple_flag = false, $attribs = false) + $selected = "", $multiple_flag = false, $attribs = false, + $action = "", $javascript = "") { + $options = array_merge(array("Select Action" => "Select Action"), $options) ; - $select = form_select($name, $options, - $selected, $multiple_flag, $attribs) ; + $select = form_select($name, $options, $selected, $multiple_flag, $attribs) ; + $form_name = $this->get_form_name(); + + $onchange = "javascript: "; + if ($action != "") { + $onchange .= "document.".$form_name.".action='".$action."';"; + } + + if ($javascript != "") { + $onchange .= $javascript . ";"; + } + + $onchange .= "document.".$form_name.".submit();"; + + if ($action != '' || $javascript != '') { + $select->set_tag_attribute("onchange", $onchange); + } + return $select; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |