spjs.ac.textField

Home Forums Requests spjs.ac.textField

  • This topic has 5 replies, 2 voices, and was last updated 1 month ago by Rad.
Viewing 5 reply threads
  • Author
    Posts
    • #39107
      Rad
      Participant

        Hi, I am using spjs.ac.textField to populate few fields when a user selects a value in Autocomplete field. But there’s one field which needs to be populated based on a Status check from a list. Wondering if it’s possible to set a value returned from a function in the spjs.ac.textField using parseFunction? If not is there a way to achieve this? I want the field populate a field as soo as user selects a value in Autocomplete field.

        function getValB(Id){
        if (ProjectCreatedDate) {
        return val = “Yes”
        } else {
        return val = “No”
        }
        }

        then :
        {
        “fromFIN”:”setValB”,
        “toFIN”:”ValB”,
        “parseFunction”:”getValB(123)”,
        “skipIfEmpty”:false
        }
        ____________________________
        saw this example of date formatting

        spjs.ac.textField({
        “applyTo”:”Project”,
        “helpText”:”Project name or number…”,
        “listGuid”:”ProjectList”,
        “listBaseUrl”:”/DFFS”,
        “showField”:”Title”,
        “enforceUniqueValues”:true, // New in v1.33
        “rowLimit”:15,
        “listOptionsOnFocus”:false,
        “reValidateOnLoad”:false,
        “allowAddNew”:false, // New in v1.4
        “isLookupInSelf”:true, // New in v1.4
        “setFields”:[
        {
        “fromFIN”:”ProjectNumber”,
        “toFIN”:”PNumber”,
        “parseFunction”:””,
        “skipIfEmpty”:false
        },
        {
        “fromFIN”:”Created”,
        “toFIN”:”ProjectCreatedDate”,
        “parseFunction”:”parseDateFunc”,
        “skipIfEmpty”:false
        }
        ]
        });

      • #39108
        Rad
        Participant

          i tried using spjs.ac.setFieldValue but doesn’t seen to to work

        • #39110
          Alexander Bautz
          Keymaster

            I’m not sure I understand exactly what you mean. The setFields part of the config for the autocomplete is used to set the value pulled in from the source list, but using a parse function you can basically set whatever value you like.

            The parsefunction should only be the name of the function like “getValB” and the function will get two parameters passed in – the value of the “fromField” and the name of the field.

            In the “getValB” function you can try something like this:

            {
                "fromFIN": "Created",
                "toFIN": "ProjectCreatedDate",
                "parseFunction": "getValB",
                "skipIfEmpty": false
            }
            
            // the function
            function getValB(created, fin){
                // Parse the date
                const createdDate = new Date(created);
                // I'm not sure what logic  you are looking form here, but
                // do some comparisons and return Yes or No
            }
            

            Alexander

          • #39111
            Rad
            Participant

              thank you, this helps.

              diff q – is there a way to hide the recycle bin and edit links from the left nav of a List view? I know it can be done for the web pages using the script editor in web part. But couldn’t find any help for a List View.

            • #39113
              Alexander Bautz
              Keymaster

                As far as I know there is no easy way to inject code in a list view without creating a SPFx solution (like an SPFx Application Customizer).

                Alexander

              • #39115
                Rad
                Participant

                  thank you

              Viewing 5 reply threads
              • You must be logged in to reply to this topic.