1
sarahmx
how do is sort select boxes alphabetically in profile module ?
  • 2012/11/6 23:55

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28




is this possible how ?

2
sarahmx
Re: how do is sort select boxes alphabetically in profile module ?
  • 2017/3/8 3:09

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


Bumping 6 year old thread

Resized Image

anyone ? How do i sort the select box created using the profile module

3
sarahmx
Re: how do is sort select boxes alphabetically in profile module ?
  • 2017/3/8 11:37

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


i saw this code in modules/profile/class/field.php
le="color: #000000"><?php case 'select': $element = new XoopsFormSelect($caption, $name, $value); // If options do not include an empty element, then add a blank option to prevent any default selection // if (!in_array('', array_keys($options))) { if (!array_key_exists('', $options)) { $element->addOption('', _NONE); $eltmsg = empty($caption) ? sprintf(_FORM_ENTER, $name) : sprintf(_FORM_ENTER, $caption); $eltmsg = str_replace('"', '"', stripslashes($eltmsg)); $element->customValidationCode[] = "nvar hasSelected = false; var selectBox = myform.{$name};" . "for (i = 0; i < selectBox.options.length; i++) { if (selectBox.options[i].selected == true && selectBox.options[i].value != '') { hasSelected = true; break; } }" . "if (!hasSelected) { window.alert("{$eltmsg}"); selectBox.focus(); return false; }"; } $element->addOptionArray($options); break;


what do i need to change ?

4
trabis
Re: how do is sort select boxes alphabetically in profile module ?
  • 2017/3/9 10:50

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Try
le="color: #000000"><?php case 'select': asort($options);

5
sarahmx
Re: how do is sort select boxes alphabetically in profile module ?
  • 2017/3/10 15:05

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


Thank you trabis..its working

Who's Online

65 user(s) are online (42 user(s) are browsing Support Forums)


Members: 0


Guests: 65


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits