1
mawi27
Selectbox
  • 2006/5/29 19:27

  • mawi27

  • Friend of XOOPS

  • Posts: 103

  • Since: 2006/1/1 1


Hi all,

i have an array of values + names and submit it to a select box :

$select->addOptionArray(array($data['ID']=>$data['Name']))

Works fine.
Now my problem is that i want one of the values preselected, e.g.:

if $data['ID'] = $defaultid

and i cannot find how to do this Any ideas?

THX in advance,

marco
--
Match Dart!
Darts Ranking, News, Videos, Forum and more

2
Codyko
Re: Selectbox
  • 2006/5/30 1:45

  • Codyko

  • Just popping in

  • Posts: 22

  • Since: 2005/8/5 7


Hi Marco

You may try this :

if ($data['ID'] [color=0000FF]==[/color$defaultid ) {
  
$select->setValue($data['ID']);
}



Hope this helps!

Regards
Cody

3
mawi27
Re: Selectbox
  • 2006/5/30 6:06

  • mawi27

  • Friend of XOOPS

  • Posts: 103

  • Since: 2006/1/1 1


Hi Codyko,

thank you for the tip. Doesn't work but helped me for searching around.
Now here is what does the trick:

$select = new XoopsFormSelect(_CAPTION, "select_data", $defaultid);
while {...
$select->addOptionArray(array($data['ID']=>$data['Name']))
}


Problem solved,

Marco
--
Match Dart!
Darts Ranking, News, Videos, Forum and more

Login

Who's Online

173 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 173


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