1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Checkboxes....Array

Discussion in 'XenForo Development Discussions' started by rainfall, Feb 12, 2014.

  1. rainfall

    rainfall New Member

    OK, I have implemented a custom page where user can choose their known languages...
    <input type=checkbox name='lang' value='English'>English
    <input type=checkbox name='lang' value='Chinese'>Chinese


    If, I checked both boxes, normally the return value should be "English, Chinese".

    Now problem in Xenforo.... what should I use? And how to get it to print "English, Chinese"???

    $this->_input->filterSingle('lang', XenForo_Input::STRING)
    this will only return me "Chinese"

    $this->_input->filterSingle('lang', XenForo_Input::ARRAY_SIMPLE)
    this will return me "ARRAY" --> array as in text A - R - R - A - Y.
    If it is an array object, how do I list it?

    and what is this???
    $lang = $this->_input->filter(array(
    'lang' => array(XenForo_Input::STRING, array('array' => true))
    ));


    Help needed. Thx.
     
  2. xf_phantom

    xf_phantom Well-Known Member

    Vincent Gabriel and Chris D like this.
  3. Lawrence

    Lawrence Well-Known Member

    It's the name of your checkboxes, they have the same name. Try name="lang_english", and name="lang_chinese" for their names.
     
  4. rainfall

    rainfall New Member

    It is for checkbox group, so "name" must be identical.
     
  5. rainfall

    rainfall New Member

Share This Page