none
alert message when click on edititem form RRS feed

  • Question

  • Hi all,

    i have  a list named testlist with title column in sharepoint 2013 site.In that list i added some items.My requirement is when i select one item in list and once click on edit item in the ribbon i need one alert box and in that alert box i need to show the title value whatever i selected.Please suggest how to implement this.Thanks in advance.

    Regards,

    praveen

    Tuesday, June 14, 2016 4:09 PM

Answers

  • Hi Praveen,

    How is everything going?

    Is there any update about this issue?

    If you have any questions, please feel free to let me know.

    And if you think that any reply is helpful, you can mark it as answer and it will help others who meet the same issue in this forum.

    Best Regards,

    Victoria


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Marked as answer by Praveenrangu Monday, June 20, 2016 5:20 AM
    Monday, June 20, 2016 1:19 AM
    Moderator

All replies

  • Hi

    create a new EditForm.aspx form -  using SharePoint Designer  -  set it as default.

    Inside that page insert the needed javascript code which show the value you want -  the easiest way using alert()


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Tuesday, June 14, 2016 4:55 PM
  • Hi Praveen,

    Not sure of the business requirement to focus on edit item from ribbon, but assuming you are planning some logic beyond the part you are able to get the selected item title.

    Option1 :
    Edit the EditForm.aspx (List Tab - > FormWebparts -> Default Edit form ). Add script to do what you want to do on page load ( script editor webpart/ content editor webpart ).

    Option 2 :
    Add a field and update it with respective Item ID on ItemAdded event. Create a calculated field ( Datatype : integer ). Use formula ( =CONCATENATE("<a href='#' onclick='mycustomscriptmethod(",ItemID,")'><img  src='customiconurl.jpg'</a>"). Define the operation you would want to do in custom javascript "mycustomscriptmethod". Refer the script in view. (In our case we did this to include Delete icon and delete operation aligned to the row item, ofcourse added with some additional logic in the script)

    Hope this helps.


    -Srini


    • Edited by Magupalli Tuesday, June 14, 2016 5:38 PM
    Tuesday, June 14, 2016 5:37 PM
  • Thanks  u very much  for your response.Can u share the javascript code.
    Wednesday, June 15, 2016 2:41 AM
  • Hi Praveen,

    Here is a demo for your reference:

    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script> 
    <script type="text/javascript">
    setInterval(MyAlert,300);
    function MyAlert(){
        var ctx = SP.ClientContext.get_current();
        var items = SP.ListOperation.Selection.getSelectedItems(ctx);
        var id = '';
        var i;
        for (i in items)
        {
            id = items[i].id;
        }
        var title=$("#"+id+"").text();
        if($("a[id^='Ribbon.ListItem.Manage.EditProperties']"))
        {
            $("a[id^='Ribbon.ListItem.Manage.EditProperties']").attr("onclick","alert('"+title+"');");
        }
    }
    </script>
    

    Best Regards,

    Victoria


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, June 16, 2016 1:52 AM
    Moderator
  • Hi Praveen,

    How is everything going?

    Is there any update about this issue?

    If you have any questions, please feel free to let me know.

    And if you think that any reply is helpful, you can mark it as answer and it will help others who meet the same issue in this forum.

    Best Regards,

    Victoria


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Marked as answer by Praveenrangu Monday, June 20, 2016 5:20 AM
    Monday, June 20, 2016 1:19 AM
    Moderator