469,902 Members | 2,039 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

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..........please help me out.........


Ex:

this is my onload().........
Expand|Select|Wrap|Line Numbers
  1. var SelectedElementId=<%=request.getParameter("selectedId") %>
  2. //var selectedPredicateType = <%=request.getParameter("selectedType") %>
  3.  
  4.    if(SelectedElementId==null)
  5.    SelectedElementId=0;
  6.    getElementValues(SelectedElementId);
  7.  
  8.  
  9.   function getElementValues(id)
  10. {
  11.    if(id==0)
  12.     {
  13.      id= <%= elementIds[0] %>;
  14.     }
  15.     SelectedElementId = id;
  16.     if(document.forms[0].SUBMIT_BUTTON.disabled == 'false')
  17. {
  18. alert("sdfsdf");
  19. }
  20.  
  21.     elementsBusinessService.getElementResult(id,formData);
  22.  }

Thanks JavaFOOL
Mar 20 '08 #1
3 10934
gits
5,390 Expert Mod 4TB
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
Mar 20 '08 #2
RamananKalirajan
607 512MB
Hi,

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


Ex:

this is my onload().........
Expand|Select|Wrap|Line Numbers
  1. var SelectedElementId=<%=request.getParameter("selectedId") %>
  2. //var selectedPredicateType = <%=request.getParameter("selectedType") %>
  3.  
  4.    if(SelectedElementId==null)
  5.    SelectedElementId=0;
  6.    getElementValues(SelectedElementId);
  7.  
  8.  
  9.   function getElementValues(id)
  10. {
  11.    if(id==0)
  12.     {
  13.      id= <%= elementIds[0] %>;
  14.     }
  15.     SelectedElementId = id;
  16.     if(document.forms[0].SUBMIT_BUTTON.disabled == 'false')
  17. {
  18. alert("sdfsdf");
  19. }
  20.  
  21.     elementsBusinessService.getElementResult(id,formData);
  22.  }

Thanks JavaFOOL
Hello Sir,
Just replace your code
var selectedPredicateType = <%=request.getParameter("selectedType") %>
by this one

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

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

Regards
Ramanan Kalirajan
Mar 21 '08 #3
The following can be used to solve this problem:
Expand|Select|Wrap|Line Numbers
  1. <div style="display:block;" id="PageLoading">
  2.  
  3.   Page loading, please wait...
  4.  
  5. </div>  
  6.  
  7. <div style="display:none;" id="PageContent">
  8.  
  9. Actual page content - this is hidden while processing the content inside this DIV
  10.  
  11. </div> 
  12.  
  13. <script language="javascript">
  14.  // Display the Content DIV
  15.  document.getElementById("PageContent").style.display="block";
  16.  // Hide the Loading DIV 
  17.  document.getElementById("PageLoading").style.display="none";
  18. </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.
Oct 15 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by BARBARA FLOYD | last post: by
1 post views Thread by hortoristic | last post: by
4 posts views Thread by Tim Meagher | last post: by
reply views Thread by Robert Ladd | last post: by
4 posts views Thread by Patrick Flaherty | last post: by
8 posts views Thread by alamodgal | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.