Hello.
In a client website, they have a form with all the Spanish provinces as Select options. The client want that when there is an address saved on client's profile, the form preloads it.
The province is saved as text string on profile. So, I explode it, and get and an array with all the address parts. Now I'm trying to set the Select's selected value to the option with same name as the province part of the address but I'm getting an error: "Method InputfieldSelect::addOptionAttributes does not exist or is not callable in this context"
What I'm doing wrong?
$field = $modules->get("InputfieldSelect");
$field->label = "Provincia";
$field->attr('id+name','provincia');
$field->addOptions([
"Alava" => "Álava/Araba",
"Albacete" => "Albacete",
"Alicante" => "Alicante",
.....
]);
$field->required = 1;
$field->addOptionAttributes($direccion[3], array("selected"));