How to change the controls value in sharepoint application page using java script RRS feed

  • Question

  • Hi all,

    I am trying to change the value of controls in sharepoint application page using java script bu I am getting fallowing error. can anyone help me to resolve this issue please.

    Message: 'document.getElementById(...)' is null or not an object


      <script  language ="javascript" type="text/javascript" >
             function displaymessage() {


                 document.getElementById('txtTotal').value = parseFloat(document.getElementById('txtBidAmmount').value) * parseFloat(document.getElementById('txtquantity').value);

    Wednesday, April 20, 2011 8:18 AM


  • Hi

    I suppose txtTotal and txtBidAmount are custom controls that you have created in your application page.

    SharePoint prefixes a very long id to this id when it renders the controls as HTML. Go to the HTML source of your application page and check if SharePoint has prefixed the txtTotal and txtBidAmount with anything.

    If it has, then you have to access the elements in javascript using their ClientIds.

    Check this post to know how to get the ClientIds in javascript.



    Wednesday, April 20, 2011 8:42 AM