Jump to content

Recommended Posts

Posted

Hi there,


I’ve built a form containing a list of products and their price. Some of these products got no exact price, mean it is individual. Ive read the API from InputSelect.module, but I don’t really understand how to add attributes to my options from the selectbox.



I am adding products like this:


 $field->addOption($prod->product_title);



Now I want to add also an attribute „disabled“ if there is no value for price. Like:



if(!$prod->product_price)


{


// Code needed ;)


}



Can somebody help me to solve this?




Greetings from Nuremberg.


Posted

Should work like this

$field->addOption(value, label, attributes);
$field->addOption(123, "Produkt1", array("disabled" => "disabled"));
  • Like 2
  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...