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

About call an input with button

1654294559
Shey L'Ours
Pro
Sheet Author
Well, I have an issue, that I can't start proprely even after reading a lot of documentation and trying to copy some other characters sheet. Its pretty simple, I have 2 box, Test 1 and Test 2, named test1 and test2. <input class="text-input-noback" style="width:100%" type="text" name="test1"/> <input class="text-input-noback" style="width:100%" type="text" name="test2"/> And I would like to call them with my button for having something like that : <button type="roll" value="&{template:default} {{test=@{test1}}} {{test=@{test2}}}" name="roll_test1"></button> Whatever I try with the {{{ and the }}} it wont work. I'm pretty fine with the Roll20 synthax, but I've never use it in that kind of "button ask to input". Sorry if it was write somewhere, either I don't see or not understand. :(
1654298111

Edited 1654298130
Kraynic
Pro
Sheet Author
If you check out common mistake #1 from the main wiki article, it will show you where you are going wrong there.&nbsp; Your attribute names (in the html, not the macro) aren't constructed correctly. <a href="https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes</a>
1654302351
Shey L'Ours
Pro
Sheet Author
Ho, fine, I'll check that, thanks for guidance :)
1654324412
GiGs
Pro
Sheet Author
API Scripter
Once you fix that, there's another issue in your roll button. You have the key test twice, each key must be unique.
1654332664
Shey L'Ours
Pro
Sheet Author
Yup, so I've correct that : &lt;input class="text-input-noback" style="width:100%" type="text" name="attr_test1"/&gt; &lt;button type="roll" value="&amp;{template:default} {{Test=@{character_name|test1}}}" name="attr_roll_test1"&gt;&lt;/button&gt; &lt;input class="text-input-noback" style="width:100%" type="text" name="attr_character_name"/&gt; &lt;button type="roll" value="&amp;{template:default} {{Test=@{test1}}}" name="attr_roll_test1"&gt;&lt;/button&gt; In the first case it give me a,&nbsp; Test character_name|test1 in the second case it give me a &nbsp; TypeError: Cannot read properties of undefined (reading 'substring') The test1 attr can be see in the macro tab also as the character_name test1 / I admit that I'm a bit lost :/
1654335621

Edited 1654335869
GiGs
Pro
Sheet Author
API Scripter
@{character_name| is incorrect intax. You also don't need to supply a name for buttons on a sheet. Just try &lt;button type="roll" value="&amp;{template:default} {{Test=@{test1}}}" name="attr_roll_test1"&gt;&lt;/button&gt; Also the name for your button is correct. Button names start with roll_ instead of attr_, so that should be &lt;button type="roll" value="&amp;{template:default} {{Test=@{test1}}}" name="roll_test1"&gt;&lt;/button&gt; Your second button has an identical name to the first - you should change that.
1654335828
GiGs
Pro
Sheet Author
API Scripter
This code should work: &lt;input class="text-input-noback" type="text" name="attr_test1"/&gt; &lt;input class="text-input-noback" type="text" name="attr_character_name"/&gt; &lt;button type="roll" value="&amp;{template:default} {{Test=@{test1}}} {{Name=@{character_name}}}" name="roll_test"&gt;&lt;/button&gt; Also I removed the style. Put that width=100% in your class. Both inputs have the same class and the same style - no need to have the style there.
1654439226
Shey L'Ours
Pro
Sheet Author
Its seem worked proprely ! I'm not expert coder as you understand :X width:100% &nbsp;help in that case ! Thanks for helping :)