ID:144792
 
Code:
For The Forms:
Form
bugreport
form_title="Report Bug"
form_reusable = 1
form_window = 1
submit = "Report"
var
bug
bug_size=50
ProcessForm()
text2file("[time2text(world.realtime)]:[usr]:[bug]","World Files/BUGS.txt")
usr<<"You reported a bug!<br>Good for you."
HtmlLayout() return \
{"What is the bug?<br>[bug]<br>[submit]"}
sugest
form_title="Submit Suggestion"
form_window = 1
form_reusable = 1
var
sugest
sugest_size=50
ProcessForm()
text2file("[time2text(world.realtime)]:[usr]:[sugest]","World Files/SUGGESTIONS.txt")
usr<<"You made a suggestion!<br>Good for you."
HtmlLayout() return \
{"What would you like to suggest?<br>[sugest]<br>[submit]"}

And How The're Called:
//I define vars for them might be wrong
var/Form/bugreport/Form2 = new
var/Form/sugest/Form1 = new

//and call them later like this don't think it's wrong
usr<<browse(Form1.DisplayForm(),"window=bre;size=300x300")

usr<<browse(Form2.DisplayForm(),"window=ssu;size=300x300")


Problem description:
I'm trying to make a CGI form that displays in a popup window in Dream Seeker. The problem is that it doesn't submit properly and I don't know how to put it in a popup window. Also,Is there a way to make the text box square? **Please note that I do see the form in the browser window in Dream Seeker.

~Hellsing4
You can use something like this :)

var/const
suggest={"Your HTML with the box."} //You can find HTML boxes on HTML sites. I think its something like <form> or something. Look it up. Then have a submit button. The thing you'll have to fill in will be a var, then you can have the submit something do something like "suggestions+=[text]<br>"
mob/verb/Suggest()
usr<<browse("[suggest]","window=suggest;size=500x500")//500x500 makes it a square.


To check people's suggestions, use something like:

world
New()
..()
var/savefile/S = new("suggestions.sav")
S["sug"] >> suggestions
if(suggestions == null)suggestions = list()
Del()
var/savefile/S = new("suggestions.sav")
S["sug"] << suggestions
..()
mob/admins/verb/CheckSuggestions()
var/html
for(var/A in suggestions)
html+="[A]"
usr<<browse(html,"window=checksuggestion;size=500x500")


I'm sure someone will say I'm making it too complicated, and theyre probably right. But thats the only way I can think of.

Edit:
And after reading the suggestions, an admin can delete the suggestions by using

mob/admins/verb/Delete_suggestions()
suggestions=list()
In response to Jay1
Dantom's CGI library has all the form handling stuff. That's what I'm using. Although I could just make it popup an input box if I can't find someone to help me with this whole CGI form thing.

~Hellsing4
In response to Hellsing4
Bump-
Someone has to have an answer for me.

~Hellsing4
hub://Dantom.CGI is not for normal BYOND worlds. It is used in DMCGI worlds (example). You shouldn't include Dantom.CGI if you plan to only use the built-in browser, as it'll probably only cause errors.

hub://Dantom.htmllib handles HTML forms, not Dantom.CGI. You should use Dantom.htmllib rather than Dantom.CGI.
That's even wrong of me to say that, since you'll most likely want to code the forms yourself rather than depend on htmllib to do it for you.

Keep in mind that in "BYOND mode" (while using DreamSeeker) you cannot use the POST method, and the GET method is limited (for instance it's difficult to upload files and you can't send large texts because there is a limit on the maximum amount of characters allowed with the GET protocol).