Disabling one attribute on selecting other

Post here questions and problems related to editing and publishing DITA content.
Raga Mounika
Posts: 49
Joined: Mon Mar 28, 2016 3:54 pm

Disabling one attribute on selecting other

Post by Raga Mounika »

Hi,

I am doing modifications in GUI using CSS.
For <image> element I have two attributes scale, scalefit. Scale consists of a textfield and scalefit has a checkbox.
When image is inserted both the attributes are displayed, later on selecting scale, scalefit should be disabled and vice versa for scalefit case.
Please help me in solving the code in CSS.

Thank you.

Regards,
Mounika
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Disabling one attribute on selecting other

Post by alex_jitianu »

Hi,

This looks to be the same requirement you've described in: viewtopic.php?f=20&t=13416

I expected the CSS block I provided there to give you this exact behavior:

Code: Select all

*[class~="topic/image"]:before {
content: "Scale: " oxy_textfield(edit, '@scale', width, 10em)
"Scalefit: " oxy_checkbox(edit, '@scalefit', values, 'yes') "\A "
}

*[class~="topic/image"][scale]:not([scalefit]):before {
content: "Scale: " oxy_textfield(edit, '@scale', width, 10em)
}


*[class~="topic/image"][scalefit]:not([scale]):before {
content: "Scalefit: " oxy_checkbox(edit, '@scalefit', values, 'yes')
}
Can you please tell me why is the CSS rule from above unfitted to your use case?

Best regards,
Alex
Raga Mounika
Posts: 49
Joined: Mon Mar 28, 2016 3:54 pm

Re: Disabling one attribute on selecting other

Post by Raga Mounika »

Hi Alex,

Thanks for the quick response :D

This code completely removes the scalefit attribute on selecting scale attribute.
I need the scalefit attribute to be read only(not editable) on selecting scale attribute.
Please help me on this.

Regards,
Mounika
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Disabling one attribute on selecting other

Post by alex_jitianu »

Hi Mounika,

@scalefit is indeed hidden when selecting @scale but as soon as you remove the value from @scale it will be presented again. This applies to both of them: as soon as you input a value in one the other disappears. As soon as you remove the value both of them are presented.

Unfortunately you can't present one and make it read-only. If what you desire is to forbid the user to give values for both of them then perhaps you can develop a Schematron rule to catch this situation. Besides that, you can provide Quick Fixes: Remove @scale or Remove @scalefit. We have a recorded Webinar that describes how to Create Schematron Quickfixes and contribute them to a framework.

Best regards,
Alex
Post Reply