Jump to content

Checkbox Multi-Select Fields


web2print

Recommended Posts

I am looking to create a document where the user can select a number of designs via the checkbox multi select field.

 

 

I want to have ONE field showing all the options but when they select options 2+, i want those to populate in separate designated locations. Please see the attached image for reference.

 

 

When i did a test, all the check boxes i selected populated in the same box which i do not want.

 

 

First of all, i am wondering if this is even possible using only ONE field or if i would need more fields. If it is, what does this look like? I assume there would be some FusionPro rule/code involved but i have no idea what that would look like as this is my first time using this feature.

 

 

 

If you think this should be posted in the fusionpro folder, let me know and i can post it there.

 

 

Thank you

ChexboxMockup.thumb.jpg.959f964f30bcd56db5f160ce93a72fe5.jpg

Link to comment
Share on other sites

I don't really have any code yet as i am not really sure where to start.

 

 

 

I cannot post the actual job art but i have attached a mock up of what i am trying to accomplish. It is the exact same as the actual job, just doesn't have the actual job art.

 

 

All the choices will be pulled from an EDF and based on those selections, other things will populate (collection, series)

 

 

Let me know if you need more from me. I really just need a starting point (what the rule/code would look like) and i should be able to go from there.

 

 

Thanks

Chexbox Mock up.zip

Link to comment
Share on other sites

Your file didn't include your XDF or a field called Design Name, so I am just taking a guess here.

 

So, it looks like Design 1 will be the field with the checkboxes, so I used that field and the Collections field for the rule.

 

When you use checkboxes in Marcom, it creates a string divided by a pipe |. So, we can change that into an array to manipulate it.

 

One way to get the data to flow into each box like you want, is to connect the frames using the "Connect Text Frame" tool (There is more info on how to use the tool in the documentation.)

Then replace your GetDesign rule code with the below code and place the rule in the linked text frames.

 

 

if (FusionPro.inValidation) {Rule("OnJobStart");}

//Declare Variables
var Design = Field("Design 1");
var Collection = Field("Collection");

//If the Design field is empty use the value from the XDF
if (Design == "") {
   var extLocation = externalDF.FindRecord("Design Name", Field("Design Name"));
   if (extLocation > 0){   
       Design = externalDF.GetFieldValue(extLocation, "Design Name");
   }
}

//If the Collection field is empty use the value from the XDF
if (Collection != "") {
   var extLocation = externalDF.FindRecord("Design Name", Field("Design Name"));
   if (extLocation > 0) {
       Collection = externalDF.GetFieldValue(extLocation, "Collection");
   }
}

//Declare Arrays
var designArray = [];
designArray = Design.split('|');
var results = [];

//Loop through the array and format
for (i=0;i<designArray.length;i++){
   results.push(designArray[i]+'<br>'+Collection);
}

return results.join("<p>");    

Hope this helps you get started. Let me know if you have any questions.

Link to comment
Share on other sites

This is excellent! Thank you! I did a few tests and was able to get the choices to populate in the different boxes via the "Connect text frames" tool.

 

 

Now that I have that working, I would like to add a ™ symbol after each design name and collection name.

 

 

I have added

<superscript>TM</superscript>

Right after

//Declare Variables
var Design = Field("Design Name") + "<superscript>TM</superscript>";
var Collection = Field("Collection") + "<superscript>TM</superscript>";

This looks like it works but the ™ is a little larger than i would like it. Is there a better way of doing this? Do you know of a way to make this smaller or actually get the symbol itself into the rule?

 

 

I tried typing the character/symbol itself and it said "illegal character"

Link to comment
Share on other sites

Now that I have that working, I would like to add a ™ symbol after each design name and collection name.

 

 

I have added

<superscript>TM</superscript>

Right after

//Declare Variables
var Design = Field("Design Name") + "<superscript>TM</superscript>";
var Collection = Field("Collection") + "<superscript>TM</superscript>";

This looks like it works but the ™ is a little larger than i would like it. Is there a better way of doing this? Do you know of a way to make this smaller

Yes. Select any text frame, double-click it to bring up the Text Editor, click Paragraph, then Global Settings, and in the Paragraph Globals dialog, adjust your superscript ratio (and the offset if you want). Or you can set the superscript and subscript offsets and ratios with attributes of a<p> tag.

or actually get the symbol itself into the rule?

 

I tried typing the character/symbol itself and it said "illegal character"

You tried typing the character/symbol itself where exactly? In the Text Editor in FusionPro? In the RTE in Marcom? In the Rule Editor?

 

Also, what is "it" that said "illegal character?" A message in the composition log? A popup dialog? Something else?

Link to comment
Share on other sites

Quote: Originally Posted by web2print http://forums.pti.com/images/buttons/viewpost.gif

or actually get the symbol itself into the rule?

 

I tried typing the character/symbol itself and it said "illegal character"

>>>

 

You tried typing the character/symbol itself where exactly? In the Text Editor in FusionPro? In the RTE in Marcom? In the Rule Editor?

 

Also, what is "it" that said "illegal character?" A message in the composition log? A popup dialog? Something else?

I tried typing it into the rule editor. Once I clicked "Validate" or "Ok", a popup dialog came up saying "Syntax error: Illegal Character"

 

 

I played around with this a little bit:

Select any text frame, double-click it to bring up the Text Editor, click Paragraph, then Global Settings, and in the Paragraph Globals dialog, adjust your superscript ratio (and the offset if you want).
and I think this will work for me!

 

 

Appreciate the help!

Link to comment
Share on other sites

I tried typing it into the rule editor. Once I clicked "Validate" or "Ok", a popup dialog came up saying "Syntax error: Illegal Character"

You need to make it part of a string literal, either in single or double quotes. This rule is valid:

return '™'; // okay

As is this:

return "™"; // okay

This is NOT valid:

return ™; // raises "SyntaxError: illegal character"

I played around with this a little bit:

and I think this will work for me!

Appreciate the help!

Great, glad to help.

 

I'm moving this thread to the JavaScript forum since it's not really specific to the MarcomCentral app.

Link to comment
Share on other sites

  • 3 months later...

Hello again

 

 

Looking back at this thread... Before I was trying to populate multiple text selections across multiple text boxes.

 

 

Now, all I am trying to do is populate multiple images across a number of graphic frames. I have used essentially the exact same rule you gave to me before for the text portion but every time I try to validate, it just says "resource does not exist". I am not understanding why this is. All the necessary resources have been added to the document and they all have the OK status.

 

 

Am hoping one of you can help me figure out what the problem is. I have attached my document for reference.

 

 

Thanks

Cambria 8.5x11 Custom Palette_V2 .zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...