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
le="color: #000000"><?php 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: 11542

  • 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.7.x | 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

le="color: #000000"><?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($value, ENT_QUOTES) . '"'; if (count($ele_value) > 0 && 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
le="color: #000000"><?php 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($value, ENT_QUOTES) . '"'; if (count($ele_value) > 0 && 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.