Page 1 of 1

combobox for inserting attribute+value in the current context

Posted: Mon May 23, 2022 9:53 am
by ttasovac
If I was creating a code template to create an element and enter the attribute value from the combobox, I would do this:

Code: Select all

<note type="footnote" resp="${ask('message', combobox, ('real_value1':'rendered_value1';'real_valueN':'rendered_valueN'), 'default')}"></note>
But what about this use case: I have an existing element

Code: Select all

<note type="footnote>blah blah</note>
and I'd like to create a code template for the Author View that will let the user insert just the attribute @resp into the current element and as its value, the selected value from the combobox. The user is not selecting the element, but their cursor is inside it.

Can I use $xpath_eval in combo with $ask to tell the code template to enter the value of the combobox into the attribute @resp of the current element?

I know I could use form controls and oxy actions for this, but in this particular case, I'd like to see if I can achieve this with a simple code template.

Many thanks in advance — and apologies for asking so many questions these days. But the customization potential of the Author View is so amazing, I'm having too much fun doing all this :)

All best,
Toma

Re: combobox for inserting attribute+value in the current context

Posted: Mon May 23, 2022 11:35 am
by alex_jitianu
Hello,

Unfortunately, I don't see a way to achieve this using a code template. In the author page, you can create an author action based on a ChangeAttributeOperation. Afterwards, you can contribute the action in the contextual menu, toolbar or even content completion window.

Best regards,
Alex

Re: combobox for inserting attribute+value in the current context

Posted: Mon May 23, 2022 11:47 am
by ttasovac
Thanks, Alex!