ReminderVDP Posted January 30, 2013 Share Posted January 30, 2013 I have been trying to suppress a graphic frame that is on top of a text frame that will suppress when the QR Code is not present and the text will not wrap. I am using this JavaScript in the rule and it gives me the error that there is no graphic frame by that name. Do I just have the code written wrong? QRCode is the name of the Graphic Frame. //Suppresses QR Code frame if empty if (Field("QRCode") == ""); { var qrcode = FindGraphicFrame("QRCode"); qrcode.suppress = true; } Quote Link to comment Share on other sites More sharing options...
esmith Posted January 30, 2013 Share Posted January 30, 2013 Where are you using that rule? It should be used in the OnRecordStart callback rule. Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 30, 2013 Author Share Posted January 30, 2013 Eric, It is used on the OnRecordStart and it gives me that syntax error every time. Quote Link to comment Share on other sites More sharing options...
step Posted January 30, 2013 Share Posted January 30, 2013 Your if statement is written incorrectly. You don't need a semicolon after the argument: if (Field("QRCode") == "")[color="Red"];[/color] { var qrcode = FindGraphicFrame("QRCode"); qrcode.suppress = true; } Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 30, 2013 Author Share Posted January 30, 2013 That doesn't work either. I don't get the syntax error but it doesn't work on the template. I have attached an example. The QRCode field is empty and the OnRecordStart suppress rule is written but it still wraps around the graphic box. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 30, 2013 Share Posted January 30, 2013 Give this a shot. if (Field("QRCode") == "") { var qrcode = FindGraphicFrame("QRCode"); qrcode.suppress = true; qrcode.textWrap = false; } Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 30, 2013 Author Share Posted January 30, 2013 Syntax error, Cannot find Graphic Frame. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 30, 2013 Share Posted January 30, 2013 Double check the semicolon. If you pasted the code from the email responder it may be wrong. I copied the code from step's post and had to do a quick edit when I realized the semicolon was still there. I'm not sure what else the problem could be. Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 30, 2013 Author Share Posted January 30, 2013 I removed the semicolon after the if statement and still got the error. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 30, 2013 Share Posted January 30, 2013 I'd say the next try would be rename the frame "QRCodeFrame" and change the code to match. This should rule out any conflicts or naming issues. Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 30, 2013 Author Share Posted January 30, 2013 Same error. Time to contact Support. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 30, 2013 Share Posted January 30, 2013 Are you sure that the name of the graphic frame itself is "QRCode", and not just the variable assigned to the frame? Can you post a screenshot of the Graphic Frame palette with that frame selected? The first box in that palette is the frame name. Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 30, 2013 Author Share Posted January 30, 2013 Sure is Dan. See attached screen shot. The rule to pull in the QR Code graphic is QRCode_TEST. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 30, 2013 Share Posted January 30, 2013 Is the frame on an Overflow or Template page? The FindTextFrame and FindGraphicFrame functions can find frames only on Body pages currently. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 30, 2013 Share Posted January 30, 2013 Your screenshot shows the name as QRcodeFrame with the "c" being lowercase. In all the examples of code it is uppercase. The frame names are case sensitive. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 30, 2013 Share Posted January 30, 2013 Your screenshot shows the name as QRcodeFrame with the "c" being lowercase. In all the examples of code it is uppercase. The frame names are case sensitive. Good eye, but that's not true. The frame names are NOT case sensitive. Reminder, could you attach the template for us to look at? Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 30, 2013 Author Share Posted January 30, 2013 Is the frame on an Overflow or Template page? The FindTextFrame and FindGraphicFrame functions can find frames only on Body pages currently. Dan, It is on a Template Page. It is one of 22 pages that are like this that get inserted into a Body Layout. Is there another way to make the graphic frame on a Template page suppress? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 30, 2013 Share Posted January 30, 2013 Dan, It is on a Template Page. It is one of 22 pages that are like this that get inserted into a Body Layout. Is there another way to make the graphic frame on a Template page suppress? Okay, mystery solved. We do have an enhancement for an upcoming release so that FindTextFrame and FindGraphicFrame will find frames on Template and Overflow pages. However, the current released versions do not support this. You can only find frames on Body pages, as the comments for these functions in the Building Blocks dialog note. I would just create an alternate version of the Template page (the reusable component) that doesn't include the graphic frame, and conditionally output that one instead as appropriate. Or, add a second text frame to the template at a higher layer than the graphic frame, so that the text doesn't wrap around it, and populate the text in there instead. Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted February 5, 2013 Author Share Posted February 5, 2013 Dan, I am trying to add a second text frame above the QR Code and the text frame that wraps around it. However, it won't suppress the wrapping text frame when I write the rule for it. //Returns Text Frame if QR Code is not present if (Field("QRCode") == "") { var textwrap = ("TOC-1-Front-Agent"); textwrap.suppress = true; return ("TextNoQR"); } Despite it validating that only the top text frame will appear (TextNoQR), both text frames are populated and it looks like a really bold line of text. Any ideas? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted February 5, 2013 Share Posted February 5, 2013 Dan, I am trying to add a second text frame above the QR Code and the text frame that wraps around it. However, it won't suppress the wrapping text frame when I write the rule for it. //Returns Text Frame if QR Code is not present if (Field("QRCode") == "") { var textwrap = ("TOC-1-Front-Agent"); textwrap.suppress = true; return ("TextNoQR"); } Despite it validating that only the top text frame will appear (TextNoQR), both text frames are populated and it looks like a really bold line of text. Any ideas? What are you expecting these two lines of code to do? var textwrap = ("TOC-1-Front-Agent"); textwrap.suppress = true;You need to call the FindTextFrame or FindGraphicFrame function to return an object which has a "suppress" property. So I think you want to do this: var textwrap = FindTextFrame("TOC-1-Front-Agent"); textwrap.suppress = true; Also, modifying the properties of frames works only in OnRecordStart, not in regular, non-callback rules. And again, it works only for Body page frames. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.