• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Disable Form - Java Script

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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()
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe some HTML attributes would help:

http://www.w3.org/TR/html401/interact/forms.html#h-17.12

Eric
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this topic still active?


Crap, nevermind.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you still have a question feel free to open your own topic on it!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic