Jump to content

tab stops not working in rule


EricC

Recommended Posts

I am using Printable's 'phoneformat' javascript rule to do the following:

- Format a phone number

- Return the phone number, then a tab, and then the phone label

 

So for example, if the customer enters:

8581234567

 

... The rule returns:

858-123-4567 phone

 

 

 

Here is a snippet of code from the phone format rule:

 

var thisNumber = Field("Fax");

//////////////////////////////////////////////////////////////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE ///////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

if (Field("Fax") == "")
   return "";
else
   return formatNumber(Trim(thisNumber)) + "\t" + "fax";

 

Now, in my FusionPro text box, I inserted the rule, and then clicked the 'Tabs...' button and tried setting a tab stop.

 

Seems like no matter what I do, the rule ignores the FusionPro text box tab settings.

 

Do I need to be specifying the tab parameters in the JavaScript rule INSTEAD OF in the FusionPro text box? Or am I doing something wrong?

 

No matter what number I enter into the FusionPro text box's Tab screen, the phone label always stays in the same position.

 

Thanks.

Link to comment
Share on other sites

Here is a snippet of code from the phone format rule:

 

return formatNumber(Trim(thisNumber)) + "\t" + "fax";

 

Now, in my FusionPro text box, I inserted the rule, and then clicked the 'Tabs...' button and tried setting a tab stop.

 

Seems like no matter what I do, the rule ignores the FusionPro text box tab settings.

 

Do I need to be specifying the tab parameters in the JavaScript rule INSTEAD OF in the FusionPro text box? Or am I doing something wrong?

 

No matter what number I enter into the FusionPro text box's Tab screen, the phone label always stays in the same position.

 

The settings in the Edit Tab Stops dialog are not the problem; the literal tab character in your rule is. FusionPro processes literal tab characters, as well as newline and carriage return characters, as whitespace. You need to use tags to actually modify formatting. Try this instead:

return FormatNumber(Trim(thisNumber)) + "<t>" + "fax";

Make sure you check "Treat returned strings as formatted text."

 

I noticed that you edited below the line that says, "DO NOT EDIT BELOW THIS LINE." ;) You might find it less confusing to use the result of the generated "Change phone format Rule" in another rule which adds the tabs and labels and such.

Link to comment
Share on other sites

LOL if anyone had been able to immediately notice where i modified that rule, it would be you! ;-)

 

well truth is, i DID venture into dangerous territory and modify the code below the "DO NOT EDIT BELOW THIS LINE" line.

 

i was aware that i could have taken the results from this rule, and used it in another rule.

 

however that didnt seem very efficient to me (using a rule within a rule), if i could achieve everything with one rule. anyway that's why i got brave.

 

oh... and the <t> tag worked (of course) just like you mentioned.

 

thanks Dan!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...