Discussion:
Inserting a linebreak into a rich text box
(too old to reply)
Patrick Temple
2005-08-29 21:35:08 UTC
Permalink
Is there a way to insert line breaks into a rich text box?

Scenario: Creating a log for a field state change. Every time the state
changes, I want to post the following informaiton into a rich text box:
Date, Last Name, First Name, State, Reason for Change.

I accomplish this using the concat() function but I don't have a way to
insert a line break to keep the log lines seperate. So it ends up being a
jumbled mess. Any ideas?

Thanks

--Patrick
Scott L. Heim [MSFT]
2005-08-30 11:56:04 UTC
Permalink
Hi Patrick,

Question: do you need to use the Rich Text control? If not, you could
simply use a text box control and enable the "Paragraph Breaks" option.

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Patrick Temple
2005-08-30 14:07:03 UTC
Permalink
Scott,

That would be fine, but how do I get the carriage return inserted.
Currently I'm using rules, do I need to do this with Javascript? The rule
looks like this:

history = concat(<history>, <date>, " ", <name>, " ", <state>, " ",
<reason>, "<carriage return>");

works fine except for <carriage return>, it converts everything to text.

Let me know what you think
Thanks

--Patrick
Post by Scott L. Heim [MSFT]
Hi Patrick,
Question: do you need to use the Rich Text control? If not, you could
simply use a text box control and enable the "Paragraph Breaks" option.
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
Scott L. Heim [MSFT]
2005-08-30 14:21:35 UTC
Permalink
Patrick,

Take a look at the following - I just tested this and it works like a champ!

http://blogs.msdn.com/infopath/search.aspx?q=line+break&p=1

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Patrick Temple
2005-08-30 14:59:11 UTC
Permalink
Scott,

That worked perfectly. Bit of a Kluge, perhaps Microsoft could look at
adding a carriage return function in following SP's. However, in the mean
time it works great. Thanks a heap.

--Patrick
Post by Scott L. Heim [MSFT]
Patrick,
Take a look at the following - I just tested this and it works like a champ!
http://blogs.msdn.com/infopath/search.aspx?q=line+break&p=1
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
Scott L. Heim [MSFT]
2005-08-30 15:20:09 UTC
Permalink
I'll be happy to pass along your comments Patrick! :-)

Take care,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Martyn Lawson
2005-10-20 15:25:06 UTC
Permalink
Hi Scott,

I have read this blog and tried to take from it what i need, but i cannot
get my example to work.

I have a sharepoint list used as secondary datasource. This list has a field
called address which is 'multiple lines of text' datatype. When the data is
brought in to InfoPath using a rule, the carriage returns are replaced with
spaces. I have a solution working by modifying the sharepoint list to use a
random character for a carriage return, such as ? and then using the
translate function in infopath to insert a CrLF using the mentioned blog.

However, as you can appreciate this is not a very sophisticated solution as
the sharepoint list looks awful. Is it possible to use the translate function
in this way? I need to know what character sharepoint is returning and when
it is converted to a space.

I thought about changing the sharepoint list to have multiple address fields
and then use the concat funtion. However, since i would be inserting CrLfs
between them i could end up with blank lines if the sharepoint field is empty.

Any help would be greatly appreciated.

Cheers,
Martyn...
Post by Scott L. Heim [MSFT]
Patrick,
Take a look at the following - I just tested this and it works like a champ!
http://blogs.msdn.com/infopath/search.aspx?q=line+break&p=1
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
Loading...