[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1217
  • Last Modified:

Expand section On Click

I have copied the NewForm.aspx of a custom list (called NewUserRequests) and renamed it to NewRequestForm.aspx.
I have inserted table inside of a row which resides underneath a row called 'CM Network Access'.
I would like to hide this embedded table unless the field above is checked 'Yes'.

I have attached the section that includes the row with the Checkbox item ('CM Network Access') and the table following that needs to be hidden until CM Network Access = 'Yes'.


<tr>
  <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">					                          <nobr>CM Network Access</nobr>							                 </H3>
   </td>
   <td width="400px" valign="top" class="ms-formbody">							<SharePoint:FormField runat="server" id="ff9{$Pos}" ControlMode="New" FieldName="CM_x0020_Network_x0020_Access" __designer:bind="{ddwrt:DataBind('i',concat('ff9',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@CM_x0020_Network_x0020_Access')}"/>
							<SharePoint:FieldDescription runat="server" id="ff9description{$Pos}" FieldName="CM_x0020_Network_x0020_Access" ControlMode="New"/>
	</td>
   </tr>						
   <tr>
	<td width="190px" valign="top" class="ms-formlabel" />
<td width="400px" valign="top" class="ms-formbody">
	<table style="width: 100%">
		<tr>
			<td width="190px" valign="top" class="ms-formlabel">	
<H3 class="ms-standardheader">
<nobr>Hardware</nobr>
</H3>
	</td>										
	<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="ff14{$Pos}" ControlMode="New" FieldName="Hardware" __designer:bind="{ddwrt:DataBind('i',concat('ff14',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Hardware')}" />
										<SharePoint:FieldDescription runat="server" id="ff14description{$Pos}" FieldName="Hardware" ControlMode="New" />										</td>
</tr>										<tr>										<td width="190px" valign="top" class="ms-formlabel">										<H3 class="ms-standardheader">										<nobr>Software</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="ff15{$Pos}" ControlMode="New" FieldName="Software" __designer:bind="{ddwrt:DataBind('i',concat('ff15',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Software')}" />
<SharePoint:FieldDescription runat="server" id="ff15description{$Pos}" FieldName="Software" ControlMode="New" />
</td>
</tr>
<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Mapped Drive</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="ff16{$Pos}" ControlMode="New" FieldName="Mapped_x0020_Drive" __designer:bind="{ddwrt:DataBind('i',concat('ff16',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Mapped_x0020_Drive')}" /><SharePoint:FieldDescription runat="server" id="ff16description{$Pos}" FieldName="Mapped_x0020_Drive" ControlMode="New" /></td></tr><tr><td width="190px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Email Address</nobr></H3></td><td width="400px" valign="top" class="ms-formbody"><SharePoint:FormField runat="server" id="ff5{$Pos}" ControlMode="New" FieldName="Email_x0020_Required_x003f_" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Email_x0020_Required_x003f_')}" /><SharePoint:FieldDescription runat="server" id="ff5description{$Pos}" FieldName="Email_x0020_Required_x003f_" ControlMode="New" /></td></tr><tr><td width="190px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Color Printer Access</nobr></H3></td><td width="400px" valign="top" class="ms-formbody"><SharePoint:FormField runat="server" id="ff6{$Pos}" ControlMode="New" FieldName="Color_x0020_Printer_x0020_Access" __designer:bind="{ddwrt:DataBind('i',concat('ff6',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Color_x0020_Printer_x0020_Access')}" /><SharePoint:FieldDescription runat="server" id="ff6description{$Pos}" FieldName="Color_x0020_Printer_x0020_Access" ControlMode="New" /></td>
										</tr></table>
										</td></tr>

Open in new window

0
Crossmatch
Asked:
Crossmatch
  • 3
1 Solution
 
CrossmatchAuthor Commented:
That gets me half way there. Thank you so much!

But I need to start with the fields as hidden, and then the click function will come in to play to display it.
Also, is it possible to toggle the whole table instead of having to enter each title of each field in to the script?

I tried the following (attached code), but the table did not hide. I am very new with javascript so any help is greatly appreciated.

Thanks!
<!--START2-->
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

<script>
$(document).ready(function()
{
$($'CMTable').hide();
$("input[title$='CM Network Access']").click(function()
{
$("input[title$='Title']").parent('span').parent('td').parent('tr').toggle();
$("nobr:contains('Start Date')").parent('h3').parent('td').parent('tr').toggle();
//$("nobr:contains('Due Date')").parent('h3').parent('td').parent('tr').toggle();
});
});
</script>
 <!--END2-->

Open in new window

0
 
CrossmatchAuthor Commented:
Was able to figure it out. Attached is the code used.

Thank you bhagavan2uday
	<!--START2-->
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script>
$(document).ready(function()
{
$("#HideThis1").hide();
$("input[title$='CM Network Access']").click(function()
{
$("#HideThis1").toggle();
});
});
</script>
 <!--END2-->

Open in new window

0
 
CrossmatchAuthor Commented:
Provided the basis of what I needed. Needed to manipulate it some to hide the table first and to hide the whole section rather than the individual fields.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now