noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 26/73: Cosmetic : select_box for javascript ,


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 26/73: Cosmetic : select_box for javascript , display the selected option
Date: Fri, 28 May 2021 05:26:27 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 05da3e2791a5cae4a4c91942f327919247956d48
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Apr 18 12:13:08 2021 +0200

    Cosmetic : select_box for javascript , display the selected option
---
 include/lib/select_box.class.php | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/lib/select_box.class.php b/include/lib/select_box.class.php
index d3a0088..2527734 100644
--- a/include/lib/select_box.class.php
+++ b/include/lib/select_box.class.php
@@ -134,7 +134,7 @@ class Select_Box
         $javascript=$this->compute_position();
 
         // display the button
-        printf('<input type="button" class="smallbutton " id="%s_bt" value="%s 
&#x25BE;" >',
+        printf('<input type="button" class="smallbutton " id="%s_bt" value="%s 
&#8681;" >',
             $this->id, $this->value);
         printf('<input type="hidden" id="%s" name="%s" value="%s">',
             $this->id, $this->id, $this->default_value);
@@ -194,10 +194,17 @@ class Select_Box
         $this->cnt++;
     }
 
-    function add_javascript($label, $javascript)
+    function add_javascript($label, $javascript,$replace=false)
     {
         $this->item[$this->cnt]['label']=$label;
-        
$this->item[$this->cnt]['javascript']=$javascript.";$('select_box{$this->id}').hide()";
+        if ( $replace )
+        {
+            $this->item[$this->cnt]['javascript']=
+                sprintf("$('%s_bt').value='%s 
\u21E9';",$this->id,str_replace("'","",$label)).
+                $javascript.";$('select_box{$this->id}').hide()";
+        } else {
+            
$this->item[$this->cnt]['javascript']=$javascript.";$('select_box{$this->id}').hide()";
+        }
         $this->item[$this->cnt]['type']="javascript";
         $this->cnt++;
     }
@@ -206,7 +213,7 @@ class Select_Box
     {
         $this->item[$this->cnt]['label']=$label;
         $this->item[$this->cnt]['update']=$value;
-        $this->item[$this->cnt]['javascript']=sprintf(" 
$('%s').value='%s';$('%s_bt').value='%s';$('select_box%s').hide()",
+        $this->item[$this->cnt]['javascript']=sprintf(" 
$('%s').value='%s';$('%s_bt').value='%s \u21E9';$('select_box%s').hide()",
                 $this->id, $value, $this->id, $label, $this->id);
         $this->item[$this->cnt]['type']='value';
         $this->cnt++;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]