1

I have an cloud page which include smart capture form, which having a checkbox, email, country and address fields. I am setting variable value to true and false using jQuery if checkbox is true or false. My code is:

var check;
jQuery("input[name='checkin']").change(function() {
  if(jQuery(this).prop('checked')==true){
    check = true;
  }
  else{
    check = true;
  }
});

Now i want to set the variable value into url. Can someone tell me how to do that so that my submit url will be (abc.com/?url=check) or with AmpScript variable (abc.com/?url=%%=v(@check)=%%)

Basically i want to run another code based on the value of by checkbox on the page that shows up after submitting the form.

1

You can get checkbox value by alternate way that is, Instead of passing variable value pass the data extension name in the URL. Then read the data extension name as parameter then lookup for checkbox value on your submit page. I am assuming your checkbox type is boolean so the code will be

set @Email = email to match for checkbox value true or false 

set @DE= RequestParameter('Your Data Extenion Name Passed as parameter')

set @value = Lookup(@DE, "checkbox field name", "email", @Email)

IF @value == True THEN

   Your Code If True

ELSEIF @opt == False THEN

    Your Code If False

ENDIF
  • Thanks for this! – James Sep 17 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.