Skip to main content
edited body
Source Link
zuzannamj
  • 14.5k
  • 3
  • 27
  • 56

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a comparison to match the values that should have checked checkboxes. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "checked"
ELSEIF @field ==  "value b" THEN
SET @valueb = "checked"
ELSEIF @field ==  "value c" THEN
SET @valuec = "checked"
ELSEIF @field ==  "value d" THEN
SET @valued = "checked"
ELSEIF @field ==  "value e" THEN
SET @valuee = "checked"
ELSEIF @field ==  "value f" THEN
SET @valuef = "checked"
 
ENDIF
next
NEXT @i
]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%

And then include the values in your form:

<form action="" method="get"><form>
  <input type="checkbox" name="valuea" value="value a" %%=v(@valuea)=%%> value a<br>
    <input type="checkbox" name="valuea"name="valueb" value="value b" %%=v(@valueb)=%%> value b<br>
    <input type="checkbox" name="valuea"name="valuec" value="value c" %%=v(@valuec)=%%> value c<br>
    <input type="checkbox" name="valuea"name="valued" value="value d" %%=v(@valued)=%%> value d<br>
    <input type="checkbox" name="valuea"name="valuee" value="value e" %%=v(@valuee)=%%> value e<br>
    <input type="checkbox" name="valuea"name="valuef" value="value f" %%=v(@valuef)=%%> value f<br>
  <input type="submit" value="Submit">
</form>

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a comparison to match the values that should have checked checkboxes. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "checked"
ELSEIF @field ==  "value b" THEN
SET @valueb = "checked"
ELSEIF @field ==  "value c" THEN
SET @valuec = "checked"
ELSEIF @field ==  "value d" THEN
SET @valued = "checked"
ELSEIF @field ==  "value e" THEN
SET @valuee = "checked"
ELSEIF @field ==  "value f" THEN
SET @valuef = "checked"
 
ENDIF
next @i
]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%

And then include the values in your form:

<form action="" method="get">
  <input type="checkbox" name="valuea" value="value a" %%=v(@valuea)=%%> value a<br>
    <input type="checkbox" name="valuea" value="value b" %%=v(@valueb)=%%> value b<br>
    <input type="checkbox" name="valuea" value="value c" %%=v(@valuec)=%%> value c<br>
    <input type="checkbox" name="valuea" value="value d" %%=v(@valued)=%%> value d<br>
    <input type="checkbox" name="valuea" value="value e" %%=v(@valuee)=%%> value e<br>
    <input type="checkbox" name="valuea" value="value f" %%=v(@valuef)=%%> value f<br>
  <input type="submit" value="Submit">
</form>

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a comparison to match the values that should have checked checkboxes. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "checked"
ELSEIF @field ==  "value b" THEN
SET @valueb = "checked"
ELSEIF @field ==  "value c" THEN
SET @valuec = "checked"
ELSEIF @field ==  "value d" THEN
SET @valued = "checked"
ELSEIF @field ==  "value e" THEN
SET @valuee = "checked"
ELSEIF @field ==  "value f" THEN
SET @valuef = "checked"
ENDIF

NEXT @i
]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%

And then include the values in your form:

 <form>
  <input type="checkbox" name="valuea" value="value a" %%=v(@valuea)=%%> value a<br>
    <input type="checkbox" name="valueb" value="value b" %%=v(@valueb)=%%> value b<br>
    <input type="checkbox" name="valuec" value="value c" %%=v(@valuec)=%%> value c<br>
    <input type="checkbox" name="valued" value="value d" %%=v(@valued)=%%> value d<br>
    <input type="checkbox" name="valuee" value="value e" %%=v(@valuee)=%%> value e<br>
    <input type="checkbox" name="valuef" value="value f" %%=v(@valuef)=%%> value f<br>
  <input type="submit" value="Submit">
</form>
added form with checkboxes
Source Link
zuzannamj
  • 14.5k
  • 3
  • 27
  • 56

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a comparison to match the values that should have checked checkboxes. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "1""checked"
ELSEIF @field ==  "value b" THEN
SET @valueb = "1""checked"
ELSEIF @field ==  "value c" THEN
SET @valuec = "1""checked"
ELSEIF @field ==  "value d" THEN
SET @valued = "1""checked"
ELSEIF @field ==  "value e" THEN
SET @valuee = "1""checked"
ELSEIF @field ==  "value f" THEN
SET @valuef = "1""checked"

ENDIF
next @i
 
]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%

And then include the values in your form:

<form action="" method="get">
  <input type="checkbox" name="valuea" value="value a" %%=v(@valuea)=%%> value a<br>
    <input type="checkbox" name="valuea" value="value b" %%=v(@valueb)=%%> value b<br>
    <input type="checkbox" name="valuea" value="value c" %%=v(@valuec)=%%> value c<br>
    <input type="checkbox" name="valuea" value="value d" %%=v(@valued)=%%> value d<br>
    <input type="checkbox" name="valuea" value="value e" %%=v(@valuee)=%%> value e<br>
    <input type="checkbox" name="valuea" value="value f" %%=v(@valuef)=%%> value f<br>
  <input type="submit" value="Submit">
</form>

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a comparison to match the values that should have checked checkboxes. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "1"
ELSEIF @field ==  "value b" THEN
SET @valueb = "1"
ELSEIF @field ==  "value c" THEN
SET @valuec = "1"
ELSEIF @field ==  "value d" THEN
SET @valued = "1"
ELSEIF @field ==  "value e" THEN
SET @valuee = "1"
ELSEIF @field ==  "value f" THEN
SET @valuef = "1"

ENDIF
next @i
 
]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a comparison to match the values that should have checked checkboxes. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "checked"
ELSEIF @field ==  "value b" THEN
SET @valueb = "checked"
ELSEIF @field ==  "value c" THEN
SET @valuec = "checked"
ELSEIF @field ==  "value d" THEN
SET @valued = "checked"
ELSEIF @field ==  "value e" THEN
SET @valuee = "checked"
ELSEIF @field ==  "value f" THEN
SET @valuef = "checked"

ENDIF
next @i
]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%

And then include the values in your form:

<form action="" method="get">
  <input type="checkbox" name="valuea" value="value a" %%=v(@valuea)=%%> value a<br>
    <input type="checkbox" name="valuea" value="value b" %%=v(@valueb)=%%> value b<br>
    <input type="checkbox" name="valuea" value="value c" %%=v(@valuec)=%%> value c<br>
    <input type="checkbox" name="valuea" value="value d" %%=v(@valued)=%%> value d<br>
    <input type="checkbox" name="valuea" value="value e" %%=v(@valuee)=%%> value e<br>
    <input type="checkbox" name="valuea" value="value f" %%=v(@valuef)=%%> value f<br>
  <input type="submit" value="Submit">
</form>
added full script
Source Link
zuzannamj
  • 14.5k
  • 3
  • 27
  • 56

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a lookup and checkcomparison to match the appropriatevalues that should have checked checkboxes accordingly. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "1"
ELSEIF @field ==  "value b" THEN
SET @valueb = "1"
ELSEIF @field ==  "value c" THEN
SET @valuec = "1"
ELSEIF @field ==  "value d" THEN
SET @valued = "1"
ELSEIF @field ==  "value e" THEN
SET @valuee = "1"
ELSEIF @field ==  "value f" THEN
SET @valuef = "1"

ENDIF
next @i

]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a lookup and check the appropriate checkboxes accordingly.

You can achieve this by using the BuildRowsetFromString AMPscript function, for example:

 SET @rowSet = BuildRowsetFromString(@value, ",")

This will build a rowset with as many rows as many values you have in that cell. You can then use a comparison to match the values that should have checked checkboxes. Here's the whole thing:

%%[
SET @value = Lookup("DataDE", "FieldA", "Email", emailaddr)
SET @rowSet = BuildRowsetFromString(@value, ",")
FOR @i=1 TO rowcount(@rowSet) DO
      set @row = Row(@rowset,@i)
      set @field = Field(@row,1)

IF @field ==  "value a" THEN
SET @valuea = "1"
ELSEIF @field ==  "value b" THEN
SET @valueb = "1"
ELSEIF @field ==  "value c" THEN
SET @valuec = "1"
ELSEIF @field ==  "value d" THEN
SET @valued = "1"
ELSEIF @field ==  "value e" THEN
SET @valuee = "1"
ELSEIF @field ==  "value f" THEN
SET @valuef = "1"

ENDIF
next @i

]%%

@valuea: %%=v(@valuea)=%%
<br>
@valueb: %%=v(@valueb)=%%
<br>
@valuec: %%=v(@valuec)=%%
<br>
@valued: %%=v(@valued)=%%
<br>
@valuee: %%=v(@valuee)=%%
<br>
@valuef: %%=v(@valuef)=%%
Source Link
zuzannamj
  • 14.5k
  • 3
  • 27
  • 56
Loading