Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Set Text on Button with fieldset attribute

July 25 (5 years ago)

Edited July 25 (5 years ago)

I'd like to create roll buttons with the name of a player's custom skills. The intent is to style away the buttons decorations so the player thinks he's clicking on regular text. The problem, of course, is I have no idea how I'd put the text of a given fieldset attribute onto the front of a button. I've left a stripped down html snippet as an example. In bold, find the mysterious, magical tag I wish worked, but doesn't. How could I achieve this?

<input type="hidden" class="sheet-skillstoggle" name="attr_skillsTab" value="skillsunlocked" />
<div class="skills-ca">    
<div class="skills-row">
<span class="skills-header-left">Other Skills</span>
<span class="skills-header-right">Abilities</span>
<button type="action" class="icons" name="act_skillslocked">)</button>
</div><fieldset class="repeating_skill"><div class="skills-row">
    <input type="text" name="attr_skillname">
   </div></fieldset>
</div> <div class="skills-cb"> <div class="skills-row"> <span class="skills-header-left">Other Skills</span> <span class="skills-header-right">Mastery</span> <button type="action" class="icons" name="act_skillsunlocked">(</button> </div><fieldset class="repeating_skill"><div class="skills-row"> <button class="roll" value="whatever">@{attr_skillname}</button> <input type="text" maxlength="3" name="attr_mastery"> <span class="unit">%</span> </div></fieldset> </div>
July 25 (5 years ago)

Edited July 25 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

You never use the attr_ part when referring to an attribute. That isnt part of the attribute name, it's a flag to tell roll20 what kind of name this is (for isntance you can have roll_ and act_ as roll button and action button names). so that should be

 <button class="roll" value="whatever">@{skillname}</button>

That probably still doesn't work, as you need something capable of reading the attribute value. A good way to do this is an attribute backed span:

<button class="roll" value="whatever"><span name="attr_skillname></span></button>

Then if you have the skillname properly defined, the name should show up. Note that you do use attr_ here. The only time you ever use it is immediately after a name=" start. You never use it with @{name} syntax.


That said, I'm curious why you have the repeating_skill fieldset defined in two separate places. That may not work as expected.

July 25 (5 years ago)

That was the missing piece, thank you!

So far, using repeating_skill in two places is working fine. skills-ca is for entering new skills, while skills-cb is the "locked" view that presents skills in a way which looks indistinguishable from the static skills hardcoded onto the sheet. I've got a button I can press to toggle between the two representations, and the repcontrol buttons will be display: none on the skills-cb view. It's working great so far.

Is this actually a bad idea? I'm trying to emulate some of the functionality one finds on the D&D 5e sheet (say, with adding new spells).

July 25 (5 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

The Patfinder 2E sheet is one where buttons for melee/ranged strikes changes name dynamically based on the strike's name, and should would in a similar manner to what you're looking for.

July 25 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter


n0q said:

That was the missing piece, thank you!

So far, using repeating_skill in two places is working fine. skills-ca is for entering new skills, while skills-cb is the "locked" view that presents skills in a way which looks indistinguishable from the static skills hardcoded onto the sheet. I've got a button I can press to toggle between the two representations, and the repcontrol buttons will be display: none on the skills-cb view. It's working great so far.

Is this actually a bad idea? I'm trying to emulate some of the functionality one finds on the D&D 5e sheet (say, with adding new spells).


No, thats a perfect way to use copies of the fieldset. I didnt realise you were toggling their visibility.