Custom JS section follow v4.4.4.1 update

Forums Dynamic Forms for SharePoint Custom JS section follow v4.4.4.1 update

This topic contains 3 replies, has 2 voices, and was last updated by  Alexander Bautz 3 weeks, 5 days ago.

  • Author
    Posts
  • #26318

    Shane Miller
    Participant

    Hello Alexander,

    On several of my forms I had lines in the custom js section that were not wrapped in function. Mostly using jQuery and spjs.utility.getItemById to append lookup values related to an external column to the form for user reference. Following the update these no longer work unless I wrap them in a function and call them by rule. Is this intended behavior? Thank you for your help.

  • #26322

    Alexander Bautz
    Keymaster

    Did the code interact with headings or HTML sections in the tabs? – if so, I might have broken it in an attempt to speed up loading of large forms with a lot of tabs with HTML using {FieldName} and {var:NameOfVariable} placeholders.

    If you can give me some more details I’ll look into it.

    Alexander

  • #26324

    Shane Miller
    Participant

    Yes the code does interact with an html
    Section in the tabs. Below is an example form a form.

    <h2> ID:<span class=“exerciseId” /></h2>
    
    
    var qres = spjs.utility.getItemsByID(
    {
    “listName”:_spPageContextInfo.pageListId,
    “id”:spjs.dffs.data.thisItemID,
    “viewFields”:[“exerciseId”]
    }
    );
    jQuery(“span.exerciseId”).html(qres[“exerciseId”].spilt(“.”)[0]);
  • #26331

    Alexander Bautz
    Keymaster

    Ah, yes, this is broken in the current release because I only draw up the HTML sections for the currently visible tab – to speed up the loading of large forms.

    I’ll try to figure out a good solution to keep backwards compatibility, but in the meantime, you can fix it by adding a placeholder in your span like this:

    <span class="exerciseId">{{var:exerciseIdVariable}}</span>

    And then change your code snippet from this:

    jQuery("span.exerciseId").html(qres["exerciseId"].spilt(".")[0]);

    to this:

    var exerciseIdVariable = qres["exerciseId"].spilt(".")[0];

    This will ensure it is updated as soon as the HTML section is made visible.

    Alexander

You must be logged in to reply to this topic.