Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 23rd, 2018, 09:31 AM
web2print web2print is offline
Junior Community Member
 
Join Date: Jul 2017
Location: Minneapolis, MN
Posts: 18
Default Checkbox Multi-Select Fields

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
Attached Images
File Type: jpg Chexbox Mock up.jpg (208.2 KB, 10 views)
Reply With Quote
  #2  
Old August 23rd, 2018, 09:47 AM
kjacobson's Avatar
kjacobson kjacobson is offline
Junior Community Member
 
Join Date: Oct 2008
Location: Alameda, CA
Posts: 48
Default Re: Checkbox Multi-Select Fields

Sounds like you need to include some conditions in your rule. Can you post the code you are currently using or attach your collected job file so we can get a better idea of what you are working with?
__________________
Windows 7 | InDesign CC 2017 | Acrobat DC 2019 | FusionPro 10.1.9
Reply With Quote
  #3  
Old August 23rd, 2018, 11:11 AM
web2print web2print is offline
Junior Community Member
 
Join Date: Jul 2017
Location: Minneapolis, MN
Posts: 18
Default Re: Checkbox Multi-Select Fields

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
Attached Files
File Type: zip Chexbox Mock up.zip (743.9 KB, 6 views)
Reply With Quote
  #4  
Old August 24th, 2018, 06:37 AM
kjacobson's Avatar
kjacobson kjacobson is offline
Junior Community Member
 
Join Date: Oct 2008
Location: Alameda, CA
Posts: 48
Default Re: Checkbox Multi-Select Fields

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.


Code:
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.
__________________
Windows 7 | InDesign CC 2017 | Acrobat DC 2019 | FusionPro 10.1.9
Reply With Quote
  #5  
Old August 24th, 2018, 10:56 AM
web2print web2print is offline
Junior Community Member
 
Join Date: Jul 2017
Location: Minneapolis, MN
Posts: 18
Default Re: Checkbox Multi-Select Fields

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
Code:
<superscript>TM</superscript>
Right after
Code:
//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"
Reply With Quote
  #6  
Old August 24th, 2018, 11:38 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,305
Default Re: Checkbox Multi-Select Fields

Quote:
Originally Posted by web2print View Post
Now that I have that working, I would like to add a ™ symbol after each design name and collection name.


I have added
Code:
<superscript>TM</superscript>
Right after
Code:
//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.
Quote:
Originally Posted by web2print View Post
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?
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #7  
Old August 24th, 2018, 12:23 PM
web2print web2print is offline
Junior Community Member
 
Join Date: Jul 2017
Location: Minneapolis, MN
Posts: 18
Default Re: Checkbox Multi-Select Fields

Quote:
Quote: Originally Posted by web2print
or actually get the symbol itself into the rule?

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

Quote:
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:
Quote:
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!
Reply With Quote
  #8  
Old August 24th, 2018, 01:09 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,305
Default Re: Checkbox Multi-Select Fields

Quote:
Originally Posted by web2print View Post
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:
Code:
return '™'; // okay
As is this:
Code:
return "™"; // okay
This is NOT valid:
Code:
return ™; // raises "SyntaxError: illegal character"
Quote:
Originally Posted by web2print View Post
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.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #9  
Old December 7th, 2018, 10:22 AM
web2print web2print is offline
Junior Community Member
 
Join Date: Jul 2017
Location: Minneapolis, MN
Posts: 18
Default Re: Checkbox Multi-Select Fields

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
Attached Files
File Type: zip Cambria 8.5x11 Custom Palette_V2 .zip (12.68 MB, 2 views)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:26 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.