Get values on DispForm

Forums Classic DFFS Get values on DispForm

Tagged: ,

Viewing 3 reply threads
  • Author
    • #11244
      Kelly Meegan

      I wanted to do some custom layout on a form (mostly checkboxes that get assigned different values based on whether they are checked or not) so I used some HTML and jquery to place the checkboxes and assign their values to their corresponding sharepoint columns. Then on the editform I use jquery to pull the value from the sharepoint column and check the checkbox if the sharepoint column value does not equal 0. This works great on the editform, however the it does not work on the dispform. I went ahead and added an alert to the code and noticed that the same alert code shows the correct value in the editform, but returns as ‘undefined’ in the dispform. I also added the fields to the tab on the dispform and they returned the proper values.

      Code being used:


      First screenshot shows the working editform, second shows the dispform which does not recognize the value assigned to the sharepoint columns.


    • #11262
      Julian Knight

      I don’t think they will be INPUT tags on the display form. You should refer to them by their ID’s instead.

    • #11280
      Alexander Bautz

      As Julian mentions above, you will not find any INPUT tags in DispForm. What you have here is the Yes / No values (depending on which language your SharePoint uses), or if you use DFFS the unicode representation of a checked / unchecked checkbox.

      You can use something like this to read the current value form the form:

      var fieldValue = getFieldValue("YourBooleanFieldName), newVal = "";
      if(fieldValue === "No"){
      	newVal = "NO - add your text or HTML code here";
      }else if(fieldValue === "Yes"){
      	newVal = "YES - add your text or HTML code here";

      Hope this gets you a bit further.


    • #11291
      Kelly Meegan

      Thanks guys,

      got it working as expected with:

      if(getFieldValue("RefArch") != "0") {
        $('#refarch').prop('checked', true);} 
Viewing 3 reply threads
  • You must be logged in to reply to this topic.