locked
How to get alert of look up value RRS feed

  • Question

  • I want to see alert message with selected value  which  i select from column(which is look up from another list column)

    I tried java script but its not working ..

    Please let me know a correct script.

    instead of script if i write a event handler in which when i will select a  value from column then  it should get value in message box and then proceed means in code i need to fetch column value and message for on select event

    Please guide if someone has done this-

     


    sudhanshu sharma Do good and cast it into river :)
    Monday, January 23, 2012 6:51 AM

All replies

  • Hi, just add the content query webpart above the listviewWebpart and in CQWP under source just add the below script and check it,

    <script srchttp://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var i = 1;
            $(".ms-listviewtable").find(".ms-vb2").find("a").click(function () {
                alert($(this).text());
                alert($(this).attr("href"));
    //To stop redirecting to list just return false
     return false;
           });
        });
    
    
    </script>
    



    Anil
    • Marked as answer by Pengyu Zhao Friday, January 27, 2012 3:05 PM
    • Unmarked as answer by sudhanshuSharma Monday, February 6, 2012 10:59 AM
    Monday, January 23, 2012 7:42 PM
  • What is wrong in this-

    in designer on newfrom.aspx i am writing-

     

    <script language="javascript" type="text/javascript">

    function PreSaveAction()
    {
      
        var a= getTagFromIdentifierAndTitle("Select","Lookup","RSOR Number");
      
          

           if (a.value)
           {
         
              alert(a.value);
              alert(a.value.select);
            
              return false;
           }
         

         return true;  // OK to proceed with the save item
    }

    function getTagFromIdentifierAndTitle(tagName, identifier, title)
    {
       var len = identifier.length;
       var tags = document.getElementsByTagName(tagName);
       for (var i=0; i < tags.length; i++)
       {
          var tempString = tags[i].id;
          if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len))
            {
             return tags[i];
             }
        }
       return null;
    }

    </script>

    ?Please let me know


    sudhanshu sharma Do good and cast it into river :)
    Monday, February 6, 2012 10:59 AM
  • I do believe you meant to say add the Content Editor web part, not Content Query. Also, when answering questions I think we all need to keep in mind that the Content Query Web part is only available in publishing site collections, and not everyone has publishing turned on everywhere.

    Imagine what we could be...If we could just imagine. Daniel A. Galant

    Sunday, February 19, 2012 1:43 AM