InfoPath Q&A: How do I copy contents from one Rich Text field to another?

Filed under: InfoPath 2003

ADVERTISEMENTS

Kurt asks:

Ok. I’m trying to use 3 different fields. We can call them field one, two, and three. Field 1 is a checkbox. Field 2 and 3 are rich text boxes. What I am trying to do on this form is when a person clicks on the check box it pulls from field two and places the information in field 3. Kind of like if field 1 is true then field 3 equals field 2. Hopefully this makes sense.

Hi Kurt,

While you can use rules and conditions to do this, you will have to write code if you want to copy the text plus its formatting from field 2 to field 3. Since you’ve told me that you’re not a programmer I will give you the steps to achieve the copying using rules and conditions.

  1. On the Properties dialog box for the check box, click Rules.
  2. On the Rules dialog box, click Add.
  3. On the Rule dialog box, click Add Action and add an action that says:
    Set a field's value: field3 = field2
  4. On the Rule dialog box, click Set Condition and add a condition that says:
    field1 is equal to TRUE
  5. On the Rules dialog box, click Add to add a second rule.
  6. On the Rule dialog box, click Add Action and add an action that says:
    Set a field's value: field3 = ""
  7. On the Rule dialog box, click Set Condition and add a condition that says:
    field1 is equal to FALSE
  8. On the Rules dialog box, click Add to add a second rule.
  9. Click OK on all open dialog boxes.

Now whenever field1 is checked, the value of field3 will be set to that of field2.

Again, if you also want to copy the formatting of the text, you will have to write code. Somone asked a similar question a while back in the InfoPath newsgroup. If you’re interested in doing this through code, take a look at this newsgroup thread: Transfer text from Rich Text Box. It contains code for use in InfoPath 2003.

 


Related Posts

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.