| Author |
Disable Form - Java Script
|
Wu Tang
Greenhorn
Joined: Oct 31, 2008
Posts: 4
|
|
Hello I'm unfamiliar with JS and I need to find a way to disable a form I've created once a condition is met. Essentially, I will pull data from a database and bases on that data the page will be editable or read only. I know how the pull the information, but don't know how to disable the page using Java Script. Here is my code: javascript:%20x() <html:form action="/SpecifyProjectRank.do"> <input type="hidden" name="allAppByUser" value="<bean:write name="sessionUser" property="username"/>" /> <html:hidden property="projectCode"/> <html:hidden property="allocationID"/> <table width="100%" height="100%"> <tr> <td id="projectHeader" height="20%"> <h1 style="font-size:9pt;font-weight:bold;height:20px;margin:0;padding:0">Allocation</h1> <table width="100%" class="main"> <tr> <tr> <td align="left"><b>Fiscal Year:</b><br> <html:text property="years" style="border:none;"disabled="false"/></td> <td align="left"><b>Service:</b><br> <html:text property="serviceName" style="border:none;"disabled="false"/></td> <td align="left"><b>Base:</b><br> <html:text property="baseName" style="border:none;"disabled="false"/></td> <td align="left"><b>State:</b><br> <html:text property="stateCode" style="border:none;"disabled="false"/></td> <td align="left" width="20%"><a href="#">View Proposal PDF</a></td> </tr> <tr> <td align="left"><b>Primary Justification:</b> <html:text property="justDesc" style="border:none;" disabled="false"/></td> <td align="left"><b>Serivce Rank:</b> <html:text property="serviceProjectRank" style="border:none;" disabled="false"/></td> <td align="left"><b>Project Status:</b> <html:text property="statusDesc" style="border:none;" disabled="false"/></td> <td> </td> <td align="left"><a href="EditProject.do?projectCode=<%=((HttpServletRequest)req).getParameter("projectCode")%>"/>Edit Details</a></td> </tr> <tr> <td align="left"><b>Created On:</b> <html:text property="dateCreated" style="border:none;"disabled="false" /></td> <td align="left"><b>Created By:</b> <html:text property="createdByUser" style="border:none;" disabled="false"/></td> <td align="left"><b>Updated On:</b> <html:text property="dateLastUpdated" style="border:none;" disabled="false"/></td> <td align="left"><b>Updated By:</b> <html:text property="updatedByUser" style="border:none;" disabled="false"/></td> </tr> <tr> <td align="left"><b>Headquarters POC Name:</b><br> <html:text property="hQPocName" style="border:none;" disabled="false"/></td> <td valign="top" align="left"><b>Headquarters POC Phone:</b><br> <html:text property="hQPocPhone" style="border:none;" disabled="false"/></td> <td valign="top" align="left"colspan="2"><b>Headquarters POC Email:</b><br> <html:text property="hQPocEmail" style="border:none;" disabled="false"/></td> </tr> <tr> <td align="left"> <b>Total Proposed Project Funds:</b><br> <html:text property="proposedTotal" style="border:none;" disabled="false"/> <td align="left"> <b>Total Project Funds Expended to Date:</b><br> <html:text property="expToDate" style="border:none;" disabled="false"/> </td> </tr> </table> </td> </tr> <tr> <td id="projectTabs" height="%" valign="top" align="left"> <table class="main"> <tr> <td style="border:solid grey 1px;background-color:lightgrey"><a href="ProjectDetailProposalService.do?projectCode=<%=((HttpServletRequest)req).getParameter("projectCode")%>"/>Proposal</a></td> <td style="border:solid grey 1px">Allocation</td> <td style="border:solid grey 1px;background-color:lightgrey"><a href="ProjectDetailObligation.do?projectCode=<%=((HttpServletRequest)req).getParameter("projectCode")%>"/>Obligation</a></td> <td style="border:solid grey 1px;background-color:lightgrey"><a href="ProjectDetailExpenditure.do?projectCode=<%=((HttpServletRequest)req).getParameter("projectCode")%>"/>Expenditure</a></td> </tr> </table> </td> </tr> <tr> <td> <table width="100%" class="main" > <tr> <td valign="top" align="left"><b>Initial OSD Rank:</b><br> <html:text property="initialOsdRank" styleClass="required" disabled="false"/> </td> <td valign="top" align="left"><b>Initial Allocation:</b><br> <html:text property="initialAllAmount" disabled="false"/> </td> </tr> <tr> <td valign="top" align="left"><b>Revised OSD Rank:</b><br> <html:text property="revisedOsdRank"disabled="false"/> </td> <td valign="top" align="left"><b>Revised Allocation:</b><br> <html:text property="revisedAllAmount"disabled="false"/> </td> </tr> <tr> <td valign="top" align="left"><b>Final OSD Rank:</b><br> <html:text property="finalOsdRank" styleClass="required" disabled="false"/> </td> <td valign="top" align="left"><b>Final Allocation:</b><br> <html:text property="finalAllAmount" styleClass="required" disabled="false"/> </td> </tr> <tr> <td valign="top" align="left" colspan="2"><b> Notes:</b><br> <html:textarea property="allNotes" style="width:50%;"disabled="false"> </html:textarea> </td> </tr> </td> </tr> </table> </table> </html:form> javascript:%20x()
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
Maybe some HTML attributes would help: http://www.w3.org/TR/html401/interact/forms.html#h-17.12 Eric
|
 |
Arun Kumar
Ranch Hand
Joined: Oct 10, 2007
Posts: 30
|
|
Have a form name(form1) and refer to it in javascript. You could call invoke javascript function on checking condition <script language="javascript"> function enableForm() { document.form1.disabled=false; } function disableForm() { document.form1.disabled=true; } </script>
|
 |
Jack Berring
Greenhorn
Joined: Feb 15, 2013
Posts: 1
|
|
Is this topic still active?
Crap, nevermind.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56540
|
|
|
If you still have a question feel free to open your own topic on it!
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Disable Form - Java Script
|
|
|