Unable to get the setFieldValue function to work.

Forums General discussion Unable to get the setFieldValue function to work.

Viewing 5 reply threads
  • Author
    Posts
    • #13542
      Harley Malamut
      Participant

      Hi Alexander,

      I have a button on a form that calls a java script function that is in the Custom JS section. That function uses setFieldValue to set a field. The field is single line text. The code fails to set the value in the field.

      Here is the line of code.

      setFieldValue(“tmpSubCodes_Process_x0020_Owner_5″,”a”);

      I have double checked the internal name and it is correct.

      However that same java script function uses the getFieldValue to retrieve a value from a field on the same form and that works just fine.

      I am using Dynamic Forms for SharePoint DFFS Backend v4.3.73 with spjs-utility version: 1.266.

      I have used the setFieldValue function in another site and it works perfectly.

      Could this issue be related to perhaps one of the .js files not being the correct release?

      I put IE in debug mode and this is the error that it encountered.

      “Unable to set property ‘innerHTML’ of undefined or null reference”

      I have resorted to using the following as a workaround:

      document.getElementById(sFieldID_ProcessOwnerContactEmail).value = ProcessOwnerContact2;

      Any help would be greatly appreciated.

      Harley

    • #13559
      Alexander Bautz
      Keymaster

      From your code snippet it looks like you have the wrong quotes around your field name. Ensure those are correct by retyping them.

      You can list all fields by typing this in the developer console and hitting enter:

      spjs.dffs.fields

      Alexander

    • #13627
      Harley Malamut
      Participant

      Hi Alexander,

      I retyped the quotes and added 2 alerts, 1 before and 1 after the setFieldValue and only the first alert runs.

      alert(“1 -Almost Finished”);

      setFieldValue(“tmpSubCodes_Process_x0020_Owner_5″,”a”);

      alert(” 2- Finished”);

      return;

      Any ideas as to why this fails?

      Harley

    • #13652
      Alexander Bautz
      Keymaster

      The quotes still looks a bit odd in the code snippet you posted above. If you are 100% sure they are the correct type (do not copy-paste, but retype all four quotes) and have ensured the fieldintenalname is correct (in the “Field table” tab in DFFS), you can try this code:

      $("#dffs_tmpSubCodes_Process_x0020_Owner_5 input").val("Your value here");

      Alexander

    • #13690
      Harley Malamut
      Participant

      I noticed that the double quotes looked funny as well. I retyped that line of code character by character and it would still not work. Also double checked the internal field name and it is correct.

      However, I was able to get your sample to work!

      Thanks for all of your help.

      Harley

    • #13694
      Alexander Bautz
      Keymaster

      I’m glad you figured it out.

      Alexander

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