Detecting blank rich text field

C

ChipD

Is there a way to detect a "blank" rich text field in code? Since it's
xhtml, it could be "blank" from the user's perspective, but the field itself
will contain xhtml tags.

You can test for "is blank" in conditional formatting; is there a way to
make the same check in code? (Or use a rule? Rules appear to be disabled for
rich text fields).

Thanks!
 
B

bratt

Data Validation:
[Your field] is blank
Place your own discription in the Screen Tip...
 
C

ChipD

Sorry, I didn't explain it well enough.

I'm displaying parts of my InfoPath document in a custom task pane. In that
display I want to indicate which rich text fields are "blank" as far as the
user's concerned, so I need a test that will work in XPath.

If I can somehow detect the "blank" condition in JScript (like the
Conditional Formatting and Data Validation allow), then I'd be willing to add
another field that is a flag just indicating that the rich text field is
"blank", so to speak.

So is there a way in JScript (or even XPath) to determine that the rich text
field doesn't have any end-user text in it?

thanks for your help,
--
Chip Davis


bratt said:
Data Validation:
[Your field] is blank
Place your own discription in the Screen Tip...

Is there a way to detect a "blank" rich text field in code? Since it's
xhtml, it could be "blank" from the user's perspective, but the field itself
will contain xhtml tags.

You can test for "is blank" in conditional formatting; is there a way to
make the same check in code? (Or use a rule? Rules appear to be disabled for
rich text fields).

Thanks!
 
F

Franck Dauché

Hi,

This is C# code, but you can get the idea:

IXMLDOMNode oNode = thisXDocument.DOM.selectSingleNode("Path to your Rich
Text Node");
int i = 0;
foreach (IXMLDOMNode oN in oNode.childNodes)
{i = i + oN.text.Trim().Length;}
thisXDocument.UI.Alert(i.ToString());

If the node is "blank", this will return 0.

Hope that gets you started.

Franck Dauché


ChipD said:
Sorry, I didn't explain it well enough.

I'm displaying parts of my InfoPath document in a custom task pane. In that
display I want to indicate which rich text fields are "blank" as far as the
user's concerned, so I need a test that will work in XPath.

If I can somehow detect the "blank" condition in JScript (like the
Conditional Formatting and Data Validation allow), then I'd be willing to add
another field that is a flag just indicating that the rich text field is
"blank", so to speak.

So is there a way in JScript (or even XPath) to determine that the rich text
field doesn't have any end-user text in it?

thanks for your help,
--
Chip Davis


bratt said:
Data Validation:
[Your field] is blank
Place your own discription in the Screen Tip...

Is there a way to detect a "blank" rich text field in code? Since it's
xhtml, it could be "blank" from the user's perspective, but the field itself
will contain xhtml tags.

You can test for "is blank" in conditional formatting; is there a way to
make the same check in code? (Or use a rule? Rules appear to be disabled for
rich text fields).

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top