Multi line Text ;\n

Forums General discussion Multi line Text ;\n

This topic contains 2 replies, has 2 voices, and was last updated by  Gulbinder Sandhu 10 months, 1 week ago.

  • Author
    Posts
  • #19664

    Gulbinder Sandhu
    Participant

    I have a cascading dropdown (multi) that selects user names into a field. The names from this field are then copied into a single line text field to control who can edit the document by custom js. When the names are saved into the single line text field it adds ‘;\n’ at he end of each name.

    Is there any Java function function that can be used to remove the ‘;\n’ when adding to the single line text field?

  • #19722

    Alexander Bautz
    Keymaster

    Not sure what function you use to move the value, but if you add something like this to the custom js it will be copied when the form is saved:

    function dffs_PreSaveAction(){
        var txt = getFieldValue("NameOfTheMultiline");
        var trimmed = txt.split(";\n").join(",");
        setFieldValue("NameOfTheSingleLine",trimmed);
    }

    This will join the string with comma – change the join(“,”) part to use another separator.

    Alexander

  • #19761

    Gulbinder Sandhu
    Participant

    Thank you. That solved the problem

You must be logged in to reply to this topic.