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

Linking the results of an attribute to the display of a drop-down

January 20 (2 years ago)
Chris Jones
Pro
Sheet Author

Afternoon.

I'm sure this is doable, but could I link which row is displayed from this drop-down to the amount of dots linked in the Radio buttons above? If so, could i do the same across multiple drop-downs, and have them all trigger based on what rating is selected?


January 20 (2 years ago)
Chris Jones
Pro
Sheet Author


January 20 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

You can do this at design type. by setting selected, like so:

<option value="whatever" selected>

For sheets that are in use, the only way to do this is by changing the current value.

January 20 (2 years ago)
Chris Jones
Pro
Sheet Author

Where you've put "whatever" there, would I replace that with the attr_ name of the radio button section?

January 20 (2 years ago)

Edited January 20 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

Option values don't start with attr_ (that goes on select at the start), but otherwise yes. See the select example on this page: https://cybersphere.me/choosing-from-a-list-select-datalist/

January 20 (2 years ago)
Chris Jones
Pro
Sheet Author

OK, I think I understand. Each element has the same attribute name, and then when I align the values, changing one will automatically change the other. Is that right?

January 20 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

If you have a select, it has one value, and you set that value by selecting a dropdown option.

January 20 (2 years ago)

Edited January 20 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

I just realised you asked about the radio button. there's a couple of ways you can do that.

(I've been talking about the select, only.)

Set the option values to your select dropdown to equal the possible values of the radio button.

Then do one of the following:

  • make the radio button and select value use the same name (the name="attr_whatever" part) - they can be the same, even though the HTML elements are not the same (radio and select).
  • Have a sheet worker that detects wehnever the selet changes, and saves its value to the radio button
January 20 (2 years ago)
Chris Jones
Pro
Sheet Author

Brilliant - works a treat, snd it's so simple!


One final question, is there a way to have pre-entrred text from the html wrap within a text box? At the moment, the longer strings are just continuing outside of view, even though the box is high enough to hold the text.

January 21 (2 years ago)

Edited January 21 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

if you want to wrap text in a text box, its best to use a textarea. inputs are single line only, and textareas multiple lines.


You can also make the input wider, if that helps.

January 21 (2 years ago)
Chris Jones
Pro
Sheet Author

Perfect. Thanks again!