Set dffsValidation with js (Display this message)

Forums Dynamic Forms for SharePoint Set dffsValidation with js (Display this message)

This topic contains 7 replies, has 2 voices, and was last updated by  becca 1 month ago.

  • Author
    Posts
  • #25301

    becca
    Participant

    How do I add, remove, and set the dffsValidation message for a field in js?

  • #25305

    Alexander Bautz
    Keymaster

    You cannot change it for individual fields, but you can change the text used by adding this to your custom js:

    var dffsRequiredFieldValidation = "This is the new message for required fields!";

    Alexander

  • #25335

    becca
    Participant

    I think we might be talking about slightly different usages, what you gave me is for if you save without filling out required fields, what I’m looking for is when this is used like an alert (e.g. rule is triggered, sets and shows Display this message).

  • #25337

    becca
    Participant

    For example, when I inspected one made from a rule on another form, the js path I could copy from it was (‘#field_internal_name_dffsValidation’), different from dffsformvalidation. But I can’t seem to get the right phrasing to set this for a field in the form I’m currently working on.

  • #25342

    Alexander Bautz
    Keymaster

    I see. This placeholder is created on the fly when a validation happens and isn’t there if the validation message isn’t showing.

    What is it you like to do exactly? – if you only need to insert your own custom message the format is like this:

    jQuery("#dffs_Color td.ms-formbody").append("<div id='myCustomMessageID' style='color:red;'>Your custom message</div>");
    // Use this to remove it again
    jQuery("#myCustomMessageID").remove();

    Alexander

  • #25363

    becca
    Participant

    I have a field on tab 1 that effects whether a field in tab 3 is editable or not by a different type of user. I want to clarify why that field isn’t editable to the higher permission users without displaying anything to the general users.

  • #25365

    becca
    Participant

    This works as intended on td.ms-formbody but not on td.dffs-readonly-inner, how should I modify this to work when also using doReadOnly on the field?

  • #25367

    becca
    Participant

    Nvm that last message, for this appending it to ms-formlabel works fine.

You must be logged in to reply to this topic.