ID:149234
 
I don't know why but for the life of me I can't figure out the syntax of it. I just want it to create a checkbox for each item in the list and display them in a popup window. I don't know how many there will be so that's why I'm not just using CHECKBOX. Here's the description on the readme page for htmllib:

"CHECKLIST
This produces a list of check boxes, each with a different corresponding value. The functionality is similar to MULTI_SELECT, but you have control over how each item in the list is displayed. This interface behaves a little differently from the others during HtmlLayout(). (1) The value of the variable is a list of the values you assigned to the _values control variable and each of these has an associated html value. (2) You access the html by indexing the interface variable with each of the possible values. When the form is processed, the interface variable will contain a list of the values checked by the user."

(1) - So do I stick the information in the _value variable or the normal variable? For a SELECT list I'd stick it in the _value variable but when it says "the variable is a list of the values you assigned to the _values..." that seems to imply I'm supposed to be doing something with the normal variable.

(2) If I try to change the html in the interface variable it says I cannot change that type of list. How am I supposed to change the html to what I want it to be?

Maybe I need to read it again tomarrow, for some reason I'm very bewildered. :(
Does anyone have a tutorial or more thurough example of using Forms in the htmllib? All I need is the syntax for CHECKLISTS so a quick example/snippet would work just as well as any explanation.
In response to English
Form/checklistdemo
form_reusable = 1
var
likes
likes_interface = CHECKLIST
likes_values = list("ice cream","chocolate","spinach")

HtmlLayout()
var/html
for(var/C in likes_values)
html += "[likes[C]] [C]<br>"
html += submit
return html

ProcessForm()
world << "[usr] likes:"
for(var/C in likes)
world << C

mob
Login()
..()
var/Form/checklistdemo/C = new()
usr = src
C.DisplayForm()
In response to Shadowdarke
Thanks for the example, that's just what I needed ;)

[Edit]

This is starting to make me feel like a newbie again, gah :p

Anyway, is there anyway to "submit" the form without actually clicking submit? I've got several buttons that do various things when clicked but I need to know which check boxes the user selected. I thought of just making a call to ProcessForm() but the Readme says, "Basic checks are performed first to make sure the form was indeed displayed to the user who is submitting it and that the input conforms to the specified limits." I think it's in those "basic checks" where the input is actually gathered, ProcessForm() doesn't seem to actually get the input.

Is there a function I can call to gather that input?

Is there anyplace that you're getting the information on how to do these things (that has more examples, explanations, etc.) or were they just learned from tinkering with them?
In response to English
I don't think there is a way to read the data without a submit action, but you could use javascript to make it submit whenever you click on a particular link or change focus on a firm element. I'll have to look up the javascript, since it's been about a year since I did anything serious in it.

I have no secret source of information. I just use the htmllib documentation and the source code to figure things out. Picking apart Dan's source code is very insightful. ;) Tons of tinkering and testing "what ifs" never hurt.
In response to Shadowdarke
It's ok, you don't have to look it up, thanks for offering though :)

I decided to go with a radio list for options instead and just have them click the submit button, it looks better than I thought it would.

I haven't learned Java or Javascript yet and I'm not sure I want to try in my current sleepless state. I've used a few cut and paste Javascript codes but that's about it.
In response to English
I shouldn't give out trade secrets here, but it's not a big one, so it shouldn't hurt.

In BYOND Tabletop Gaming, one of the field types you can include in a sheet is a checkbox, and the program knows the instant that you click the checkbox. It even supports options for a three state check box (unchecked, marked with a slash, or marked with an X) that IE does not support. I did it by making images of each checkbox state. The image is a BYOND Topic() link to the checkbox obj that tells it to toggle.

If you are using the form as an options panel, you might benifit from a system like this. You don't even have to worry with the images. Just use an onClick javascript to send the BYOND event.