ID:1693123
 
Keywords: browse, output
(See the best response by Phat T.)
Code:
var/html = {"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<title>Ticket Log Viewer</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type='text/javascript'>
function sync(test) {
$('#messages').append('<p>Testing</p>');
}
</script>
</head>
<body scroll='yes'><div id='messages'>Content</div></body>
</html>"}


// Create the browser
src << browse(html, "window=ViewLog")

// Later run this
src << output("test", "ViewLog:sync")


Problem description:

I am attempting to create a browser, and at arbitrary points to send additional data to the browser. So that it does not need to be completely refreshed.

So far, I have not managed to make the output() function work. I have seen several webpages explaining that it works, but is there something that I am not grasping?

Is there perhaps more official documentation explaining this functionality?

Or is there a better way of performing this function?
Best response
var
list
reports = list(/**/)
mob
verb
View_Reports(/**/)
var/html = {"<font size=3><b>Reports: </b></font size>
<hr>
<font color=black>
<font size=2>"}

if(length(reports))
for(var/r in reports) html+="[r]<br><br>"
else html+="<br><b>No Reports</b>"
html+="<br>---------------------------<br><br><b><u>Current Time</u>: [Clock(/**/)]</b>"
usr<<browse(html,"window=who,size=550x600")

        File_Report(/**/)
var/reportcategory = input("Filing your report, go with whatever category your report is supposed to be in or is closest to.","File Report")\
in list("Bug","Map Error","Grammar Mistake","Admin Abuse","Player Abuse","Other","Cancel")
if(reportcategory == "Cancel")
return
var/reportname = input("Please name your report.","Report Name") as text | null
if(!reportname)
src<<"<font color=red>Your report failed to send, because it has no name"
return
if(length(reportname) > 50)
src<<"<font color=red>Your report failed to send, because it was longer than 50 character"
return
var/reportdesc = input("Now please explain your report\n- Your IP, Key, and Name are being logged","Explanation")
if(!reportdesc)
src<<"<font color=red>Your report failed to send, because it had no explanation"
return
reports+="[GetDate(/**/)]\
- <b>
[reportcategory]</b>\
[src.client.address] - [src] ([src.key])\
<br><b><u>
[html_encode(reportname)]</u></b>\
<br>
[html_encode(reportdesc)]\
<br>---"

src<<output("<font color=red>Your report has been sent, thank you","Chat")
Admin_Alert("<font color=red>Admin Alert: <font color=#0F79D0>[src] ([src.key]) - {[src.client.address ? "src.client.address" : "Unknown Address"]} has filled out a report")


This is my example of using it for reporting errors atc... It might help ya out. Make a list, save text on list and than use it in your html :)
Hi Kn0ss0s,

The basics of this feature are documented in the reference entry for output.

The issue you're having is that a browser pop-up is actually two controls, the window and the browser. Your window is named "ViewLog", not your browser, so your script isn't receiving the message.

This little nugget is hidden in the reference entry on browse():
The name of the window is the same name you gave the popup, and the browser is "[windowname].browser".

So just change your output() line to this and it should start working:
src << output("test", "ViewLog.browser:sync")


Alternatively, you could explicitly include the browser control in your interface somewhere and give it the name you want.
In response to DarkCampainger
DarkCampainger wrote:
So just change your output() line to this and it should start working:
src << output("test", "ViewLog.browser:sync")


That was it. Thank you very much for the reference link and the very helpful answer.