Jump to content

NikkiC

Caspio Ninja
  • Posts

    39
  • Joined

  • Last visited

Reputation Activity

  1. Like
    NikkiC got a reaction from Harbinger in Inline edit only in certain circumstances   
    Hi there,
    I have a tabular report with inline edit and delete enabled.  This report shows a list of comments made by different users.  I wish to only show the edit / delete options for the user who has made the comment.   I have tried this:
    <script> var user = "[@authfield:User_info_User_ID]"; var author = "[@field:Card_comments_and_updates_Author_ID]"; if (user === author) { document.getElementByClassName("cbResultSetActionCell").style.display = "block"; } if (user !== author) { document.getElementByClassName("cbResultSetActionCell").style.display = "none"; } </script> but it's not working.  I think it's something to do with the fact I've used "getElementByClassName", but there is no ID assigned to this field, so not sure how to reference it.  I've added an html field to write YEP if the user=author and NOPE if not, just to check this is working OK, which it is in the attached screenshot, so I just want to apply this same logic to show or hide the edit / delete (which is inside this row:
    <td class="cbResultSetActionCell cbResultSetData"> The only other way I can think of to do this is to completely hide the edit / delete section, and then add a new one in, in the html field where I've currently got the YEP/NOPE. But I don't know what custom link needs to go in there for edit and delete, or if this can even be done in the same way you can add a custom save / delete button in a datapage.
    Any help would be much appreciated!
    Many thanks
    Nikki 

  2. Like
    NikkiC got a reaction from lmooring in Star ratings   
    I've managed to get the rating to update back to the database  thought I'd post in case anybody else finds it useful:
    <div id="el" class="c-rating"></div> <script src="http://www.cambridgedata.org/Testboard/manager/five-star-rating-master/js/dist/rating.min.js"></script> <script> // target element var el = document.querySelector('#el'); // current rating, or initial rating var currentRating; if ([@field:QA_Tester_Rating#] > 0) { currentRating = [@field:QA_Tester_Rating#]; } else { currentRating = 0; } // max rating, i.e. number of stars you want var maxRating = 5; // callback to run after setting the rating var callback = function(rating) {document.getElementById("EditRecordQA_Tester_Rating").value=(rating); }; // rating instance var myRating = rating(el, currentRating, maxRating, callback); </script> Only thing that's not working is making the value 0 if the field is empty.  So if the field in the table is empty (as it is by default) then the stars don't show at all.  Can anyone help with this bit?
    // current rating, or initial rating var currentRating; if ([@field:QA_Tester_Rating#] > 0) { currentRating = [@field:QA_Tester_Rating#]; } else { currentRating = 0; } Many thanks!
×
×
  • Create New...