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!