Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 100

NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
10/09/13 07:28 PM (12 years ago)

Alert View plugin (Add line break in JSON data)

Is there a way to embed a line break in the Message for the Alert in the App Control Panel? (like adding a CR or CRLF) Probably a JSON Data question, but not sure how PlugIn parses text? I could just edit the JSON Data if someone can point me in the right direction. Example: Entered: Text for line one followed by text on line two. Generates JSON: {"itemId":"MyItemID", "itemType":"JC_AlertView", "itemNickname":"Help Email Image", "alertTitle":"Tips for Emailing an Image", "alertMessage":"Text for line one followed by text on line two.", "button1Title":"Ok"} Displays: Text for line one followed by text on line two. ----- In this example I would like it to display Text for line one followed by text on line two.
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
10/09/13 08:35 PM (12 years ago)
@NCbuzz: I have tested this solution and it works with my plugin, AlertMenu. Add a \n where you want to break the line. An example is this: Alert Message\nAlert Message Will produce: Alert Message Alert Message Note: When the Control Panel saves the text, it will omit the \n, however, it will still produce the desired result. Always make sure the back-slash is in the text box, before you save again. Does this work? Jake
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
10/10/13 05:08 AM (12 years ago)
Thanks Jake. Works great! Adding \n in message creates \\n in JSON data \n Will force end of line \n\n Will leave a blank line
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.