Page 1 of 1
Checkbox with Labeltext on the left side
Posted: Tue Jan 19, 2016 10:58 am
by NickHenig
Hello,
I'm trying to create a Checkbox with the labeltext on the left side. Is that possible? I can't find an option for that.
Best regards
Re: Checkbox with Labeltext on the left side
Posted: Wed Jan 20, 2016 3:33 pm
by jwilliams
Hi Nick, the easiest way to do this is to remove the label property from the Checkbox and add a label widget to the left side of the Checkbox.
Re: Checkbox with Labeltext on the left side
Posted: Thu Jan 21, 2016 3:13 am
by NickHenig
Hi J,
yes, but then you can't click on the label text to toggle the checkbox. That's the problem.
regards
Re: Checkbox with Labeltext on the left side
Posted: Thu Jan 21, 2016 4:37 am
by dieter
Hello Nick,
i know that my suggestion is not very smart, but it should work: Do so, as jwilliam said. Use an extra label at the left side of the checkbox. Then lay an onClick event on that label. In the OnClick event you can code a click on the checkbox.
Dieter
Re: Checkbox with Labeltext on the left side
Posted: Thu Jan 21, 2016 6:20 am
by NickHenig
Hi Dieter,
thank you for your reply.
Yes, that is possible.
A nicer way to do it is to set the for attribute of the label to the Checkbox
like that: $("[id='label1']").next().children().first().attr('for', 'checkbox1');
But it's a lot of work to do that for every checkbox.
I'd prefer to have a custom widget or something like that. (the best solution would be to have a Lable align in the Profound Widget ;) )
Re: Checkbox with Labeltext on the left side
Posted: Thu Jan 21, 2016 6:36 am
by dieter
Yes. Sometime i also wished to have the label on the left side. So a Profound attribute would be the best solution.
We use customized widgets only. But we did not create a really custom widget. We derive every widget, which is used. The derived widgets have attributes which give them a standard look and feel. So normally we don't have the necessity to change colors or fonts. But i am not sure if it is possible to add a java script to a derived widget.
Dieter
Re: Checkbox with Labeltext on the left side
Posted: Thu Jan 21, 2016 9:52 am
by NickHenig
I found a solution, but ....
I add a css class to the checkboxes named rightCheck
and in the onLoad event I do:
$('.rightCheck').each(function() {
if (($(this).css('left')) < ($(this).next().css('left')))
{
$(this).next().css("left", $(this).css('left'));
var checkboxleft = parseInt($(this).css('left')) + parseInt($(this).next().css('width')) + 5;
$(this).css("left", checkboxleft + "px");
}
});
that works, but ...
I can't change the width of the checkbox field so the width depends on the length of the labletext.
Leading and Trailing Spaces are trimmed even if I toggle off:
Trim Leading Spaces
Trim Trailing Spaces ..... :(
Re: Checkbox with Labeltext on the left side
Posted: Thu Jan 21, 2016 10:30 am
by Scott Klement
If you'd like to request a feature in Profound UI, you can do so by sending an e-maill to
support@profoundlogic.com
The spaces aren't trimmed from the checkbox label if you un-check the "trim blanks" options in the binding dialog, but they also do not show up on the display. This is because HTML/browsers don't normally show extra spaces, they act as if they are not there. For other dialogs, we replace blanks with non-breaking spaces (under the covers) to solve this problem, but it looks like that wasn't done with checkbox labels. This is another feature you could request from
support@profoundlogic.com
Re: Checkbox with Labeltext on the left side
Posted: Fri Jan 22, 2016 3:26 am
by NickHenig
thank you very much. I'll send an email regarding that issue :)