Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

ACC: Web App Data storage of Checkbox data

Avatar

Level 2

(Updated)

Upon reviewing everything, the data is being stored properly when I change the type from checkbox to text, so I think it is about the way I am saving the checkbox data.

(picture below should have a row under language for Online Booking, and it does not.)

bryceh57660644_0-1591050275025.png

 

I am creating my first web app landing page in ACC and while I have all of my text input fields working, I am struggling to get the checkboxes to relay the data I want.

bryceh57660644_0-1591017147917.png

In the HTML, I have set the values - if checked - to be = 1

 

2020-06-01_9-16-03.png2020-06-01_9-18-01.png

 

I was also looking into a data transfer issue, but the variables used in the web app, the HTML and data schema all line up:

2020-06-01_9-20-42.png

 

Any help would be greatly appreciated.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @bryceh57660644 

If you to store the checkbox value and treat it as a boolean then here is the code

 

HTML

<input type="checkbox" id="agree" label="agree">

JS

if(document.getElementById('agree').checked){
 document.controller.setValue('/ctx/vars/CHECKBOX_VARIABLE',"true");
 }  else{
  document.controller.setValue('/ctx/vars/CHECKBOX_VARIABLE',"false");
 }

 

Let me know if that helps

View solution in original post

6 Replies

Avatar

Community Advisor

Hello @bryceh57660644 

Are you trying to preload the data and have the checkbox checked automatically with the variable data?

If yes, What you can do is

<input type="checkbox" name="name" <% if(ctx.vars.VARIABLE_NAME =='YOUR_VALUE' ) { %>checked <% } %>>

Avatar

Level 2
No, I want them to check the box. I am just not 100% sure how to get that data in the schema I guess.

Avatar

Level 2

@Manoj_Kumar_ no I am looking to have the recipient check the box of the service they are interested in.  Once they check the items they are interested in, and hit submit, I want the form to submit a Yes or 1 response to the data schema.  I have the fields as type="boolean" at the moment.

Avatar

Community Advisor
I don't think Type="boolean" is valid. If you want to have something like that you may want to use a checkbox instead. If the checkbox is checked then you will consider it as 1 or Yes. If the check is unchecked then you can consider is 0 or NO

Avatar

Level 2
@Manoj_Kumar_ it seems like the issue is around the data note getting passed through for some reason.

Avatar

Correct answer by
Community Advisor

Hello @bryceh57660644 

If you to store the checkbox value and treat it as a boolean then here is the code

 

HTML

<input type="checkbox" id="agree" label="agree">

JS

if(document.getElementById('agree').checked){
 document.controller.setValue('/ctx/vars/CHECKBOX_VARIABLE',"true");
 }  else{
  document.controller.setValue('/ctx/vars/CHECKBOX_VARIABLE',"false");
 }

 

Let me know if that helps