Stevebenson223
Member
I have a radiobutton element with two values, 0 and 1 (Labels of "Nomination" and "Winner" respectively). If the element value is 1, I would like to display the label "Winner" font in red and bold on the Details page (if it's displayed in red/bold on the form too, that's OK). I should add that the element is in a repeating group.
I tried to do this in the custom template but it turned the whole group red and bold. It seemed easier to do it using the JavaScript option in the element itself, but as I've little or no clue about JavaScript, I cobbled the code together from various wiki parts and it didn't work. This was my attempt:
I know the setStyle lines work on their own, but I can't figure out how to write the if condition. If any kind person with more JS experience could possibly point out what I'm doing wrong, I'd be very grateful.
Thanks.
I tried to do this in the custom template but it turned the whole group red and bold. It seemed easier to do it using the JavaScript option in the element itself, but as I've little or no clue about JavaScript, I cobbled the code together from various wiki parts and it didn't work. This was my attempt:
JavaScript:
var winner = Fabrik.getBlock('form_1').elements.get('productions_15_repeat___winner_nomination').getValue();
if (winner == 1) {
this.element.setStyle('color','red');
this.element.setStyle('font-weight','bold');
}
I know the setStyle lines work on their own, but I can't figure out how to write the if condition. If any kind person with more JS experience could possibly point out what I'm doing wrong, I'd be very grateful.
Thanks.