Use Form Control to Add Value to Attribute

Oxygen general issues.
dreifsnider
Posts: 24
Joined: Thu Aug 30, 2018 10:06 pm

Use Form Control to Add Value to Attribute

Post by dreifsnider »

Hello!

I'm trying to implement a form control to let authors easily control the values of the @outputclass attribute. I'd like for them to be able to add a variety of attribute values in a variety of combinations. For example, I'd like for them to be able to set the @outputclass for an image directly in Author Mode to various combinations of float-left, box-shadow, and thumbnail.

I've tried using both oxy_checkbox and oxy_combobox, but both of these directly overwrite the entire @outputclass values with the selected value instead of simply adding the value.

Essentially, I'm wondering if there's a way to simply append a value to the existing attribute values instead of entirely overwriting the attribute values.

Thanks!
Daniel
Gabriel Titerlea
Site Admin
Posts: 89
Joined: Thu Jun 09, 2016 2:01 pm

Re: Use Form Control to Add Value to Attribute

Post by Gabriel Titerlea »

Hello,

If you know all the possible values that the outputclass attribute will have, writing them in the values part should be enough:

Code: Select all

oxy_combobox(edit @outputclass, values "box-shadow, float-left, other-value1, other-value2")
If this solution does not work for you, you'll need to implement an AuthorOperation [1] that changes the attribute of the currently selected node [2].
Best,
Gabriel

[1] https://www.oxygenxml.com/doc/versions/ ... ments.html
[2] https://www.oxygenxml.com/doc/versions/ ... -node.html
dreifsnider
Posts: 24
Joined: Thu Aug 30, 2018 10:06 pm

Re: Use Form Control to Add Value to Attribute

Post by dreifsnider »

Thank you for your reply Gabriel!

Unfortunately, I don't think the oxy_combobox will work, because it looks like a user can't select more than one option at a time, for example, they wouldn't be able to select both float-left and box-shadow; it's either one or the other. I supposed I could add every combination of values as a separate, unique value, but this seems unmanageable especially given that the list of allowed values can potentially grow.

I will explore the other form controls to see they would work instead, specifically, checkbox and popup.

I will also look into create a custom Author Operation, but my Java skills might not be enough to do this successfully. :lol:

Thanks again!
Daniel
Post Reply