Jump to content

Search the Community

Showing results for tags 'InputfieldSelectMultiple'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. I am trying to get the "text Content" (not the value) portion of an InputfieldSelectMultiple property I created for an installed module. The selected options are saved in PW somewhere. How do I get at it? viz: <select name="fieldA"> <option selected value=0>Content 1</option> <option value=1>Content 2</option> <option selected value=2>Content 3</option> </select> I know its an array and that i'd have to access the options in a loop. But I can't seem to make the right call to any of the methods that return an array. So, here's an example of many that i tried and failed: $module = wire('modules')->get('ImportMyModule'); $field = $module->get('fieldA'); $options = $field->getOptions(); foreach($options as $key => $val) { echo "key: ", $key, " val: ", $val; } I can't figure out to get at just the "text Content" for now , then the selected one's after. (in the above sample "Content 1" and "Content 3") It'll save me a bunch of if's. Thanks forum!
  2. Hello everybody, I am playing with the InputfieldSelectMultiple module, and I was wondering how to set the "selected" attribute for an Option? I have the following code: $field = $modules->get("InputfieldSelectMultiple"); $field->label = "Multiple select"; $field->attr('id+name', 'options'); $field->setAttribute('multiple', 'multiple'); $field->setAttribute('size', '8'); $field->addOption('121', '121-22', array('selected' => 'selected')); Which gives me this: <option selected='selected' selected="selected" value='121'>121-22</option> While it technically makes an option selected, this also produces redundant HTML code which does not validate. So, what's the right way to use addOption() so that the output is more like <option selected value=...> ? Thanks.
×
×
  • Create New...