ID:147852
 
I'm trying to set the default values for an html Form CHECKLIST interface var. Ive been setting the var to a list of possible values in the Forms Initialize() proc, however, I'm having trouble when the user unchecks all of the boxes. Rather than being set to null, or an empty list, the variable is being left as what I set it to in Form/Initialize().

As long as one of the boxes is checked, everything works fine, but if all of them are unchecked, I get back the previous list. Is there some other way to set these default values, is this a bug, or I am just mangling the heck out of this?

Heres a quick test:
Form
test
var
options
options_interface = CHECKLIST
options_values = list("Option_1", "Option_2")

Initialize()
..()
var/mob/M = usr
var/templist[0]
if(M.option1)
templist += "Option_1"
if(M.option2)
templist += "Option_2"
options = templist


ProcessForm()
var/mob/M = usr
var/list/templist = options
M.option1 = FALSE
M.option2 = FALSE
if(templist)
if(templist.Find("Option_1"))
M.option1 = TRUE
if(templist.Find("Option_2"))
M.option2 = TRUE
M << browse(null)

mob
var
option1 = FALSE
option2 = FALSE

verb
Show_Options()
src << "Option 1: [option1], Option 2: [option2]"
Set_Options()
var/Form/test/T = new()
T.DisplayForm(src)
Don't use var_values.

I can't remember exactly, but I think it's something like var_option1, var_option2. That's not it, but someone else will no what I'm saying.