How to handle form load and form submit?

Forums Dynamic Forms for SharePoint How to handle form load and form submit?

Viewing 1 reply thread
  • Author
    • #33586

      I have come across scenario where i need to bind some fields when new form will be open, value should be come from another list, i will use rest api call to get data from other list, but how can i bind data into field before form will be load?

      same, i will create some html input fields and want to store those field data into other SharePoint list on submit button, how can i achieve this?


    • #33590
      Alexander Bautz

      When your REST call returns the value you want to fill in a field you use this function to set it:

      setFieldValue("The_field_internal_name_of_your_field", the_value_from_your_rest_call);

      Sending data to another list on save can be done by adding the HTML in a HTML section in your form, and then add this code to your Custom JS:

      // Keep track of the custom function being completed
      var hasSubmittedCustomHTML = false;
      // Used to ensure the custom HTML is not saved multiple times if save is not hit multiple times
      var isSavingCustomHTML = false;
      function doSaveCustomHTML(){
          // Add your custom REST call here and add the two below rows in the success/done callback from your REST call
          hasSubmittedCustomHTML = true;
      function dffs_PreSaveAction() {
                  isSavingCustomHTML = true;
                  // run your custom REST function to update another list
              return false; // Return false to wait for the custom function to finish
              // Custom HTML submitted - save item
              return true; // Continue saving item

      Please note that the actual HTML and the custom REST API call to save the custom HTML is not included here.


Viewing 1 reply thread
  • You must be logged in to reply to this topic.