Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

[SugarCube 2.13] Unable to use multiple radiobutton groups on the same passage?

$
0
0
I'm designing a passage a game with a passage that has a few customizable options. For reason of clarity and aesthetics alone I was opting to utilize the <radiobutton> macro as opposed to an anchor when I noticed what seemed to me to be odd behavior.

When using the radiobutton macro the first grouping will have the id assigned as expected, but the second does not. Instead of an ordering applied to the ID you'll receive a "Not a Number" designation to the ID.


Example:
<<nobr>>
<table>
	<tr>
		<td width="40%">
			Measurement system:
		</td>
		<td>
			<<if $imperial eq true>>
				<<radiobutton "$imperial" "true" checked>>
			<<else>>
				<<radiobutton "$imperial" "true">>
			<<endif>>
			
			<<if $imperial eq false>>
				<<radiobutton "$imperial" "false" checked>>
			<<else>>
				<<radiobutton "$imperial" "false">>
			<<endif>>
		</td>
	</tr>
	<tr>
		<td width="40%">
			Enable Cheats:
		</td>
		<td>
			<<if $cheatMode eq true>>
				<<radiobutton "$cheatMode" "true" checked>>
			<<else>>
				<<radiobutton "$cheatMode" "true">>
			<<endif>>
			
			<<if $cheatMode eq false>>
				<<radiobutton "$cheatMode" "false" checked>>
			<<else>>
				<<radiobutton "$cheatMode" "false">>
			<<endif>>
		</td>
	</tr>
</table>
<</nobr>>


Which results in:
<table>
	<tr>
		<td width="40%">Measurement system:</td>
		<td>
			<input id="radiobutton-imperial-0" name="radiobutton-imperial" type="radio" tabindex="0" class="macro-radiobutton">
			<input id="radiobutton-imperial-1" name="radiobutton-imperial" type="radio" tabindex="0" class="macro-radiobutton">
		</td>
	</tr>
	<tr>
		<td width="40%">Enable Cheats:</td>
 		<td>
			<input id="radiobutton-cheatmode-NaN" name="radiobutton-cheatmode" type="radio" tabindex="0" class="macro-radiobutton">
			<input id="radiobutton-cheatmode-NaN" name="radiobutton-cheatmode" type="radio" tabindex="0" class="macro-radiobutton">
		</td>
	</tr>
</table>

For the sake of curiosity I've swapped table rows around to see if the behavior was repeatable when sure enough whichever group of radiobuttons comes second is id'd with a Not a Number postfix.

Did I do something really dumb and implement the control incorrectly?

Viewing all articles
Browse latest Browse all 1844

Trending Articles