buffer with checkboxes

3001
1
Jump to solution
08-03-2015 11:32 AM
TaN
by
New Contributor II

Hi!

I'm trying to create 4 checkboxes (values- in miles- are 0.5, 1, 1.5, 2). I want to make it so that the values of checkboxes that are checked get inputted as params.distances (for buffers). I've tried for hours and I can't seem to get the dojo checkbox to show up.

When I included 'dijit/form/CheckBox', I followed the example tutorial. Widget.js had the following:

var distances = [];

        var cboxpt5 = new CheckBox({

            name: "cboxpt5",

            value: "0.5",

            checked: false,

            onclick: function(){distances.push(cboxpt5.value);}

        }, "cboxpt5").startup();

in Widget.html, I had:

<input id="cboxpt5" /><label for="cboxpt5">0.5</label>

I kept getting just a text field when I launched the web app, so I figured that somehow, the checkbox form widget.js was not being conveyed to widget.html.

I looked at a code sample of Robert S. and I noticed he used 'jimu/dijit/CheckBox'. But using that module didn't work either. Any ideas? Thank you!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

TA,

  The main issue was including dijits requires _WidgetsInTemplateMixin require and declare in your code.

Here is your code updated:

View solution in original post

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

TA,

  The main issue was including dijits requires _WidgetsInTemplateMixin require and declare in your code.

Here is your code updated:

0 Kudos