ACC: Web App Data storage of Checkbox data

bryceh57660644

01-06-2020

(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.

Adobe Campaign Classic data issue web apps

Accepted Solutions (1)

Accepted Solutions (1)

_Manoj_Kumar

MVP

02-06-2020

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

Answers (2)

Answers (2)

bryceh57660644

01-06-2020

@_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.

_Manoj_Kumar

MVP

01-06-2020

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 <% } %>>