Jump to content

Suppressing empty fields


Recommended Posts

Hi All

I am very new to fusion pro and i am in need of some advice.

I am creating a business card lets say with two rows with two fields

in each row ie

<<phone>> <<Fax>>

<<mobile>> <<e-mail>>

So what i am trying to achieve is if any field is empty i want to suppress, and move to the next available field, move the field horizontally and Vertically if fax is empty move mobile in it's place and move e-mail left.

Is this possible?

Thanks in advance.


Ken Straker

Link to comment
Share on other sites

Shouldn't you filter the second array to avoid a line break being added after a string with 2 or less items?


return [ items.slice(0, 2).join(" "), items.slice(2).join(" ") ][color="Red"].filter(String)[/color].join("<br>\n");

Link to comment
Share on other sites

Thanks for you swift response, i am not sure what i am doing wrong,but when i use the rule

i get line 2: typeError: items.filter is not a function

What am i missing?

That's because you're using a version of FusionPro older than 8.0. I would have known this if either (a) you specified the version you're using in your post, or in your signature or (b) my ESP was working. See my signature below for recommendations on how to be specific about the versions of things you're using in order to get better answers to your questions.


In your older version of FusionPro, you can add the code from this post to your JavaScript Globals:


One small thing i did'nt mention if iam using a FaxNumberRule ie Tel: +44 (0) to return before my phone or fax number how will this work in the rule?

Sure, you can call out other rules to populate the array instead of just using fields, like so in the first line:

var items = [ Rule("phoneNumberRule"), Rule("FaxNumberRule"), Rule("mobileNumberRule"), Field("e-mail") ];

Of course, I'm guessing at your other rule names.

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.

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...