Page 1 of 1

Variable default value for $ask()

Posted: Tue May 20, 2014 12:37 pm
by afuchs
Dear Board Members,

I am setting up an author action for a certain framework. The action is relatively simple and uses the ChangeAttributeOperation to, well, change an attribute of the node that has been right-clicked.

I use the "editor variable" ${ask} and the user is prompted for the desired value.
I'd like to set the text field that the user gets first to the current value of the attribute. To this end I have to put an xpath expression into the 'default' argument of the ${ask} expression. Is this somehow possible? Is there another solution?

More generally, is it possible to use xpath anywhere in the arguments of the author operations?

Thank you in advance.

Re: Variable default value for $ask()

Posted: Tue May 20, 2014 2:04 pm
by Radu
Hi Alexey,

In Oxygen 15.2 you do not have this possibility.
We plan to release Oxygen 16.0 this week and in Oxygen 16.0 you will have a brand new editor variable called xpath_eval. You will be able to use it inside the ask editor variable like

Code: Select all

${xpath_eval(@id)}
and it will return for example the value of the ID attribute on the current element.
Basically the entire ChangeAttributeOperation parameter value will be something like:

Code: Select all

${ask('Set new ID attribute', generic, '${xpath_eval(@id)}')}


Regards,
Radu

Re: Variable default value for $ask()

Posted: Tue May 20, 2014 3:08 pm
by afuchs
Thank you, Radu,

I am looking forward to the release.

As for now, I have come up with a workaround through CSS using oxy_editor with a value composed of the necessary XPath expressions.

However, I still cannot force a default value into the combo, so that the user does not start with an unset value. Is there a way to set a default value for an oxy_editor combo?

Re: Variable default value for $ask()

Posted: Tue May 20, 2014 4:42 pm
by Radu
Hi Alexey,

The presented combo box has nothing in it probably because the XML element does not have a value set for that attribute.
Did you somehow want that when the user click inside the combo box to automatically set an initial value for him to start with? As far as I know we do not have such functionality, you would need to create your own Java-based implementation of a form control for this so it would take some development effort.

Oxygen 16.0 has just been released on our web site, the xpath_eval function is now described here:

http://www.oxygenxml.com/doc/ug-editor/#topics/editor-variables.html

Regards,
Radu

Re: Variable default value for $ask()

Posted: Wed May 21, 2014 9:52 am
by afuchs
Thank you, Radu,

I am impatient to start trying it out.