Refer to a field in tab headings?

Forums Dynamic Forms for SharePoint Refer to a field in tab headings?

This topic contains 5 replies, has 2 voices, and was last updated by  Kyle McGrath 2 years, 7 months ago.

  • Author
    Posts
  • #6884

    Kyle McGrath
    Participant

    Hi Alex,

    Great work with this solution! It’s been saving me a ton of trouble and I definitely am going to purchase a license in February! πŸ™‚

    I’m curious if there’s any way to display a field value for the current item in the tab headers? (This would obviously only be for EditForm and DispForm). We are using DFFS to create a ticket/tracking system to replace our old one, and we’re trying to make it a clone of the old one. I’ve gotten pretty much everything setup with CSS and side-by-side, but this would be the icing on the cake if the ticket number can go into one of our tab headers!

    I’ve included a screenshot of the header.

    Thanks!
    Kyle

    Attachments:
  • #6889

    Alexander Bautz
    Keymaster

    Hi,
    This is no problem. Add this code to the header (see image attached):

    PM Number: <span id="putPMNumberHere" />

    Then use this code in the custom JS section in the Misc tab:

    // For DispForm
    $("#putPMNumberHere").html(getFieldValue("YourFieldName",true));
    // For EditForm
    $("#putPMNumberHere").html(getFieldValue("YourFieldName",false));

    PS: “YourFieldName” is the FieldInternalName – change it for your actual field name.

    Hope this helps
    Alexander

    • This reply was modified 2 years, 7 months ago by  Alexander Bautz. Reason: Fixed error in code example
  • #6891

    Kyle McGrath
    Participant

    Hey Alex,

    I’ve tried this, but to no avail. I’m still just getting the same “PM Number:” with nothing there. I’ve attached screenshots of my DispForm config.

    Note that I’ve also tried “PM Number” as well instead of the “Title” internal field name, still no luck.

    Thanks!
    Kyle

  • #6895

    Alexander Bautz
    Keymaster

    Sorry, my bad – there was an error in the code example. See if this helps.

    Alexander

  • #6896

    Kyle McGrath
    Participant

    Ah, good old brackets.

    Working like a charm now! Thanks so much! πŸ˜€

  • #6898

    Kyle McGrath
    Participant

    For anyone who comes across Alex’s solution to this:

    I had this header for every tab on my page (essentially, the form showed the PM number on every single tab in the same spot). You may run into trouble with it only showing on the first tab. You can fix this by modifying the code to the following:

    PM Number: <span class="putPMNumberHere" />
    
    
    // For DispForm
    $(".putPMNumberHere").html(getFieldValue("YourFieldName",true));
    // For EditForm
    $(".putPMNumberHere").html(getFieldValue("YourFieldName",false));

    Just use classes instead of ID’s πŸ™‚

You must be logged in to reply to this topic.