How can I use Checkbox Form Control as Radio button ?

Post here questions and problems related to oXygen frameworks/document types.
Celero
Posts: 2
Joined: Mon Sep 09, 2013 1:17 pm

How can I use Checkbox Form Control as Radio button ?

Post by Celero » Mon Sep 09, 2013 1:24 pm

Hi,

I'm using Oxygen API and I would like to edit a specific value from my XML content. I'm trying to edit this value using the CheckBox Form Control (and it works) but I'd like that the checkboxes would be unique. I mean like HTML radio buttons. Is there a way to achieve this behaviour ?

There is my CSS code :

Code: Select all

oxy_editor(
type, check,
edit, "#text",
values, "1,2,3",
columns, 30,
labels, "1,2,3");
Thanks for your answer

alex_jitianu
Posts: 662
Joined: Wed Nov 16, 2005 11:11 am

Re: How can I use Checkbox Form Control as Radio button ?

Post by alex_jitianu » Mon Sep 09, 2013 2:34 pm

Hi,

The check box form control doesn't have such a built in behavior but you can get something similar by using 3 check box form controls instead of just one:

Code: Select all


content: 
oxy_checkbox(edit, "#text", values, "1", uncheckedValues, "1", labels, "First")
oxy_checkbox(edit, "#text", values, "2", uncheckedValues, "2", labels, "Second")
oxy_checkbox(edit, "#text", values, "3", uncheckedValues, "3", labels, "Third");
The user will be able to select only one check box and will not be able to leave all the check boxes unchecked. What's missing is the "radio button" look (the buttons will still look like check boxes).

Another possible solution is for you to implement a custom form control that looks and behaves as required. As a starting point I can send you the JAVA source code for the built in check box form control. Modifying it for your use case should be simple enough. If you want to go on this road please let me know and I will send you the source code.

Best regards,
Alex

Celero
Posts: 2
Joined: Mon Sep 09, 2013 1:17 pm

Re: How can I use Checkbox Form Control as Radio button ?

Post by Celero » Mon Sep 09, 2013 4:23 pm

Thanks for your reply,

It works great with your solution.

Thanks a lot

Post Reply