How to disable/Enable the button while loading the jsp page using javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • javafool
    New Member
    • Mar 2008
    • 1

    How to disable/Enable the button while loading the jsp page using javascript

    Hi,

    in my case i want to disable the button while clicking onload() in my jsp page........... ..but i can't do that..........p lease help me out.........


    Ex:

    this is my onload()....... ..
    [CODE=java]var SelectedElement Id=<%=request.g etParameter("se lectedId") %>
    //var selectedPredica teType = <%=request.getP arameter("selec tedType") %>

    if(SelectedElem entId==null)
    SelectedElement Id=0;
    getElementValue s(SelectedEleme ntId);


    function getElementValue s(id)
    {
    if(id==0)
    {
    id= <%= elementIds[0] %>;
    }
    SelectedElement Id = id;
    if(document.for ms[0].SUBMIT_BUTTON. disabled == 'false')
    {
    alert("sdfsdf") ;
    }

    elementsBusines sService.getEle mentResult(id,f ormData);
    }[/CODE]


    Thanks JavaFOOL
    Last edited by gits; Mar 20 '08, 01:19 PM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    what do you mean exactly? you want the button enabled after! the page has loaded ... and otherwise it should be disabled?

    if so ... you could add the disabled attribute to the html-code and onload you remove it from the node ...

    kind regards

    Comment

    • RamananKalirajan
      Contributor
      • Mar 2008
      • 608

      #3
      Originally posted by javafool
      Hi,

      in my case i want to disable the button while clicking onload() in my jsp page........... ..but i can't do that..........p lease help me out.........


      Ex:

      this is my onload()....... ..
      [CODE=java]var SelectedElement Id=<%=request.g etParameter("se lectedId") %>
      //var selectedPredica teType = <%=request.getP arameter("selec tedType") %>

      if(SelectedElem entId==null)
      SelectedElement Id=0;
      getElementValue s(SelectedEleme ntId);


      function getElementValue s(id)
      {
      if(id==0)
      {
      id= <%= elementIds[0] %>;
      }
      SelectedElement Id = id;
      if(document.for ms[0].SUBMIT_BUTTON. disabled == 'false')
      {
      alert("sdfsdf") ;
      }

      elementsBusines sService.getEle mentResult(id,f ormData);
      }[/CODE]


      Thanks JavaFOOL
      Hello Sir,
      Just replace your code
      var selectedPredica teType = <%=request.getP arameter("selec tedType") %>
      by this one

      <%
      String s = (String)request .getParameter(" selectedType"). toString();
      %>

      var selectedPredica teType = "<%=s%>";
      Just try it out and tell me the result.

      Regards
      Ramanan Kalirajan

      Comment

      • Louis Moll

        #4
        The following can be used to solve this problem:
        Code:
        <div style="display:block;" id="PageLoading">
                  
          Page loading, please wait...
              
        </div>  
        
        <div style="display:none;" id="PageContent">
        
        Actual page content - this is hidden while processing the content inside this DIV
        
        </div> 
        
        <script language="javascript">
         // Display the Content DIV
         document.getElementById("PageContent").style.display="block";
         // Hide the Loading DIV 
         document.getElementById("PageLoading").style.display="none";
        </script>

        In summary:
        1 - The page loading DIV is displayed
        2 - The page contenet DIV is not displayed
        3 - After putting the content DIV together the script displays this DIV and the loading DIV is hidden.
        Last edited by Frinavale; Oct 15 '10, 08:35 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.

        Comment

        Working...