May 1 2016 wsurvey_choser documentation. wsurvey_choser is a javascript libarary that is part of the wSurvey package. It contains functions that will create html code containing a set of checkboxes that allows the end-user (the person looking at the browser) to "chose values". The enduser can chose zero, one, or more values (by clicking on checkboxes). Selected values are returned (via a callback) as an array Useage: at the top of the HTML, include: // or you can use some other version of jquery! See wsurvey_choser_demo.htm for an example of useage Functions: :::::: content=wsChoser_create(items,options,myCallback,displayOptions) -- creates content to be displayed items: array of choice specifications, each row an object with id,message,comment, title, and group fields options: display options (optional) myCallback : string -- name of function to call on submit (optional) displayOptions: object -- how to display generated content (optional) What is returned in content: HTML content listing these choices, with buttons to choose. The submit button for this table will call the callback, with an array of ids that were chosen as the first argument, and callArgs as the second argument. The programmer should display this content -- say using $('#showme').html(content) ; wsChoser_style(atype,prefix,afactor) -- format content using some pre-defined styles atype: which pre-defined style to use prefix : optional -- should match the prefix defined in options (in wsChoser_create) afactor : scalar, or array, of options (depends on the atype) choices=wsChoser_submit(prefix,afunc,arg2) -- return an array of the values of the selected (checkbox checked) choices prefix : optional -- should match the prefix defined in options (in wsChoser_create) afunc: call back function (a string naming the function, or a function reference) arg2 : optional. Argument passed to afunc as 2nd argument (first is array of selected choices) choices is an array containing the values (the id fields) of the selected choices ::::::::::::::::::::::: function details :::::::::::::::::::: wsChoser_create(items,options,myCallback,displayOptions) -- creates content to be displayed Arguments items: The choices MUST an array. Each row is a specific choice, structured as an associative array, with fields: message, id, comment, title, group None of the fields are required (defaults will be used). The following fields are supported: id: value returned when this checkbox is checked. If not specified, use "choice_n" comment: text placed next to message (smaller, oblique, font). If not specified, nothing written group: the "group number" this is in. If not specified, the current group number (which starts at 1) is used message: text displayed next to checkbox (in a