Rules not working on a Rich text field - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Rules not working on a Rich text field

Last post 06-15-2020 01:35 AM by DavidHolmes. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-11-2020 04:06 AM

    Rules not working on a Rich text field

    Hi, I have a Rich text field called "RequestDetails" and what to disable the submit button when this field is empty or has less than 4 letters. I have created a rule that sets a numeric field "ValidRequest" to 1 if "RequestDetails" contains " " and a rule to disable the submit button if "ValidAction = 0" which appears to be working as "ValidRequest" has a default value of 0. The situation I have is that the you are able to edit that field and potentially remove the text and when you do this the rule still believes that "RequestDetails" still contains " " when indeed it is either empty/blank or has no spaces in it. So ask is how can reset "ValidRequest" to 0 so that submit button is disabled if "RequestDetails" is amended . Any help greatly apricated as I am going round in circles, all my other field types which are type "String" work with a rules where they set other Valid states depending on whether they match the requirements or not. Below is the output from the rules inspector Calculated Default Values None Actions RequestDetails: set if invalid Conditions not(xdUtil:Match(string(RequestDetails), "\p{L}+[ ]\p{L}+")) Actions Set a field's value: ValidAction = 0 RequestDetails: set valid action if not blank Conditions xdUtil:Match(string(RequestDetails), "\p{L}+[ ]\p{L}+") Actions Set a field's value: ValidAction = 1
  • 06-11-2020 03:43 PM In reply to

    Re: Rules not working on a Rich text field

    Any chance I can see your form? You can attach it under the Options tab in a reply.... When you test this, are you tabbing out of the rich text field prior to looking to see if the rules have executed?
    Hilary Stoupa

  • 06-12-2020 01:15 AM In reply to

    Re: Rules not working on a Rich text field

    Hi Hilary, many thanks for responding so quickly and taking the time to help. I have attached the form as it is but please note it has a couple of SharePoint lookups so it may not work. When I test this I am clicking into another field rather tabbing which I would hope would do the same thing, indeed it does. These are the actions I take. Enter a valid entry , click to another field ( rule works ) click back to that field , remove the entry , click to another field (rules are ignored :-( ) and the ValidAction is left in the positive state Below is the rule for string field called "ChangeNo" which is working even if the "user" moves to another field and returns to it to remove the entry. So in short the issue I am trying code for is ensuring all required fields have some entries before the Submit button is enabled and disable it anything changes that is invalid. ChangeNo: Invalid change number Conditions ChangeNo != "N/A" or not(xdUtil:Match(string(ChangeNo), "[C]+[H]+[G]+\d\d\d\d\d\d\d")) Actions Set a field's value: ValidServiceNow = 0 ChangeNo: Valid change number Conditions ChangeNo = "N/A" or xdUtil:Match(string(ChangeNo), "[C]+[H]+[G]+\d\d\d\d\d\d\d") Actions Set a field's value: ValidServiceNow = 1
  • 06-12-2020 01:45 AM In reply to

    Tried to edit my message above but failed :-( I have attached here another form that pulled together to show the issue without all my other fields and lookups. In this form it has the same fields so RequiredAction, and ValidAction and I am using the following pattern "\p{L}+[ ]\p{L}+" to check before setting the value of ValidAction , as you see from the form the pattern only allows for two words so I clearly have more work here :-)
  • 06-12-2020 09:01 AM In reply to

    Re: Rules not working on a Rich text field

    Okay, rules don't seem to be executing on the Rich Text field when it is set to blank (which surprises me - if this will be a browser form you may want to verify you have the same behavior in the browser). So - you may just need to add another rule to specifically disable the submit button if the field is blank.
    Hilary Stoupa

  • 06-15-2020 01:35 AM In reply to

    Re: Rules not working on a Rich text field

    Hilary, again thanks for looking at the issue. Ive added another rule to the submit button to disable if the rich text field is blank (my:RequiredAction = "") which does appear to get over the issue.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.