Page 1 of 1

Using ChangeAttributeOperation in oxy_combobox onChange

Posted: Fri Jan 22, 2021 5:34 pm
by Johannab_31
Hello,

I hope you can help. I'm using XML Editor 20.1 and XML Author 20.1. I'm working on a custom CSS style-sheet that will be used online in the Web Author.

I want to update the outputclass attribute value based on the value that the user enters for the title element. The title element will be a combobox.

DITA xml

Code: Select all

<concept deliverymethod="E-Learning" id="concept-cpr_zxf_2op" outputclass="need_to_know">
		<title>Need To Know</title>

I got it to work using the 'XQueryUpdateOperation' but I believe that isn't supported in the web author so I switched to using the 'ChangeAttributeOperation' operation i.e.

CSS

Code: Select all

learningContent[outputclass~="stay_current"] *[class~="concept/concept"] > *[class~="topic/title"]:first-child:before {
    content: oxy_label(text, "Title*: ", styles, "width:5%; color:black;")
        oxy_combobox(           
            edit, "#text",
            editable, false,
            values, "Highlights, Need To Know, Assessment",
            /*onChange, oxy_action(
                name, 'Insert',
                operation, 'XQueryUpdateOperation',
                arg-script, 'replace value of node ../@outputclass with replace(lower-case(.), " ", "_")')
            );*/
            onChange, oxy_action(
                name, 'ChangeOutputClass',
                operation, 'ChangeAttributeOperation',
                arg-name, 'outputclass',
                arg-elementLocation, '..',
                arg-value, oxy_xpath("replace(lower-case(text()), ' ', '_')")
                )
            );
}
The problem is that @outclass is updated with the title value before the dropdown change e.g if the title is 'TEST 1' and I change it to "TEST 2" the value of @outputclass is changed to 'TEST 1' - not the new value.

Can you figure out a way to achieve this?

Many Thanks for your help

Re: Using ChangeAttributeOperation in oxy_combobox onChange

Posted: Fri Jan 22, 2021 6:01 pm
by cristi_talau
Hello,

The support for onChange property was added in version 21.1 of Web Author. Are you able to upgrade Web Author to a newer version to solve this issue?

Best,
Cristian