1
Tarik
XoopsFormSelect classes not shown
  • 2012/2/4 20:10

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


Hello, I'm currently developing a Xoops module and used jquery and after some searching i found that XoopsFormSelect doesnt give the classes like the other inputs
class='".$this->getClass()."'
is it intended or what?

it took me a lot of time to find the problem with my code so wanted to share it
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.

2
Mamba
Re: XoopsFormSelect classes not shown
  • 2012/2/5 6:38

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Can you give an example how you use it, and where it works and where it doesn't?

I am not sure I understand the issue here...
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
Tarik
Re: XoopsFormSelect classes not shown
  • 2012/2/5 21:53

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


its not really a bug but a snippet forgotten - which is the same thing :p -
this the render function for formselect.php

function render()
    {
        
$ele_name $this->getName();
        
$ele_title $this->getTitle();
        
$ele_value $this->getValue();
        
$ele_options $this->getOptions();
        
$ret '<select size="' $this->getSize() . '"' $this->getExtra();
        if (
$this->isMultiple() != false) {
            
$ret .= ' name="' $ele_name '[]" id="' $ele_name '" title="'$ele_title'" multiple="multiple">' ;
        } else {
            
$ret .= ' name="' $ele_name '" id="' $ele_name '" title="'$ele_title'">' ;
        }
        foreach(
$ele_options as $value => $name) {
            
$ret .= '<option value="' htmlspecialchars($valueENT_QUOTES) . '"';
            if (
count($ele_value) > && in_array($value$ele_value)) {
                
$ret .= ' selected="selected"';
            }
            
$ret .= '>' $name '</option>' ;
        }
        
$ret .= '</select>';
        return 
$ret;
    }

the id , name and title are added to the select but not the class
so it should just add some little changes
function render()
    {
        
$ele_name $this->getName();
        
$ele_class $this->getClass();
        
$ele_title $this->getTitle();
        
$ele_value $this->getValue();
        
$ele_options $this->getOptions();
        
$ret '<select size="' $this->getSize() . '"' $this->getExtra();
        if (
$this->isMultiple() != false) {
            
$ret .= ' name="' $ele_name '[]" id="' $ele_name '" class="'$ele_class .'" title="'$ele_title'" multiple="multiple">' ;
        } else {
            
$ret .= ' name="' $ele_name '" id="' $ele_name '" class="'$ele_class .'"  title="'$ele_title'">' ;
        }
        foreach(
$ele_options as $value => $name) {
            
$ret .= '<option value="' htmlspecialchars($valueENT_QUOTES) . '"';
            if (
count($ele_value) > && in_array($value$ele_value)) {
                
$ret .= ' selected="selected"';
            }
            
$ret .= '>' $name '</option>' ;
        }
        
$ret .= '</select>';
        return 
$ret;
    }
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.

Login

Who's Online

264 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 264


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits