RPTools.net

Discussion and Support

Skip to content

It is currently Wed Jan 17, 2018 11:22 pm 






Reply to topic  [ 3 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Wed Sep 20, 2017 8:24 pm
Posts: 16
 Post subject: Can you load token Notes into an editable Frame?
PostPosted: Thu Dec 14, 2017 2:00 am 
Hi,

I'm working on building character sheets for tokens.
I was wanting to have a tab which is just a big editable notes field where players can enter large amounts of extra info that does not have specific fields on the other character sheet tabs.
I assumed the best place to store this would be the Tokens "Notes" field.

So first I am unsure of how to access the notes field.
I'm also not sure how to make an editable text box within a frame.
Currently I have links to input macros to update fields.
I'm happy to do that here but still don't know how to load multiline inputs.

Any thoughts?

Templar


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri May 12, 2006 7:56 pm
Posts: 6347
Location: Middle of Nowhere, NM
 Post subject: Re: Can you load token Notes into an editable Frame?
PostPosted: Fri Dec 15, 2017 1:43 pm 
In theory you could use the textarea html tag in a form but I don't know if the subset of HTML that is supported by Java includes textarea.

See the wiki page Introduction_to_Dialogs_and_Frames for an example of using html forms in dialogs.


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Sun Jan 24, 2010 3:07 pm
Posts: 46
 Post subject: Re: Can you load token Notes into an editable Frame?
PostPosted: Tue Dec 19, 2017 9:03 pm 
Yes, you can use the textarea form input type.

Try using something like this

Code:
[h: tokID=currentToken()]
[h: switchToken(tokID)]

[h: tokNotes=encode(getNotes())]
<!-- you need to clean the note text here to prevent unpleasant results. -->

[h: css='
    <style>
    <!--css goes here-->
    th {background-color:#CC32EE;
        color:#FFFFEE;}
    </style>']
[h: processorLink = macroLinkText("form.process@token","self","",currentToken())]

[h: updateButton='<input type="submit" name="update" value="Update Token">']
[h: notesTextArea='<textarea name="tokenNotes" cols= "89" rows="36">'+decode(tokNotes)+'</textarea>']

[h: frameHTML=strformat('
<html>
    <head>
        <title>Edit Token Notes</title>
        %{css}
    </head>
    <form action="%{processorLink}" method="json" >
   
    <input type="hidden" name="stored.args" value=macro.args>

   <table width=100%>
        <tr><th width=100% align=center>Your tab links/images/cells/whatever here.</th></tr>
        <tr><td align=right>%{updateButton}</td></tr>
        <tr><td align=center>%{notesTextArea}</td></tr>
    </table>
   
   </form>
</html>')]
 
[r,frame("MyFrameName", "width=300; height=700; temporary=0;"):   {[r:frameHTML]}]


Because people can have absolutely anything in their notes, you will need to clean/replace characters that will trip up the HTML, stripping out HTML tags and replacing " & ' should be enough generally.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 3 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman