Seven0fNine
asked on
Hiding SharePoint URL field (spfieldURL) using jquery
I am having trouble hiding a SharePoint URL field on an EditForm.aspx.
Client Link Type the Web address: (Click here to test)
[_________________________ ___]
Type the description: [_________________________ ___]
I can hide other controls such as Date picker, People picker, drop-down and single text fields using jquery:
$('td.ms-formlabel:contain s("Start Date")').parent().hide();
$('td.ms-formlabel:contain s("TaskNam e")').pare nt().hide( );
$('td.ms-formlabel:contain s("Status" )').parent ().hide();
However, this code does not hide the URL field:
$('td.ms-formlabel:contain s("ClientU RL")').par ent().hide ();
Appreciate it if someone could help,
Thank you
Client Link Type the Web address: (Click here to test)
[_________________________
Type the description: [_________________________
I can hide other controls such as Date picker, People picker, drop-down and single text fields using jquery:
$('td.ms-formlabel:contain
$('td.ms-formlabel:contain
$('td.ms-formlabel:contain
However, this code does not hide the URL field:
$('td.ms-formlabel:contain
Appreciate it if someone could help,
Thank you
ASKER
Thanks for your reply: I have selected the whole object - the field reference I am using is the FieldInternalName, I cannot see any other references... other than the Input type IDs..
so the jquery that is not working is using $('td.ms-formlabel:contains("DeskSite_x0020_Folder_x0020_ Link")').parent().hide();
so the jquery that is not working is using $('td.ms-formlabel:contains("DeskSite_x0020_Folder_x0020_ Link")').parent().hide();
no, what you're showing is acommented HTML, it CAN'T be that
it's just before
if you can't locate it, right click the the full table anc copy/paste the table outerHTML here
your screenshots doesn't help, it just show your interpretation
it's just before
if you can't locate it, right click the the full table anc copy/paste the table outerHTML here
your screenshots doesn't help, it just show your interpretation
ASKER
Below is the outerHTML <tr> section where the SP URL control is contained:
<tr>
<td nowrap="true" valign="top" width="113px" class="ms-formlabel"><span class="ms-h3 ms-standardheader">
<nobr>Desksite Folder Link</nobr>
</span></td>
<td valign="top" width="350px" class="ms-formbody">
<!-- FieldName="Desksite Folder Link"
FieldInternalName="Desksite_x0020_Folder_x0020_Link"
FieldType="SPFieldURL"
-->
<span dir="none"><span class="ms-formdescription">Type the Web address: (<a id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlControlId" href="javascript:TestURL('Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldUrl')" target="_self">Click here to test</a>)<br></span><input dir="ltr" type="text" value="http://Redirect.aspx?FID=2388721" id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldUrl" title="Desksite Folder Link" class="ms-long" style="ime-mode : "><br><span class="ms-formdescription">Type the description: <br></span><input type="text" maxlength="255" id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldDescription" title="Description" value="Open Client page" class="ms-long"><br></span>
</td>
</tr>
<tr>
<td nowrap="true" valign="top" width="113px" class="ms-formlabel"><span class="ms-h3 ms-standardheader">
<nobr>Desksite Folder Link</nobr>
</span></td>
<td valign="top" width="350px" class="ms-formbody">
<!-- FieldName="Desksite Folder Link"
FieldInternalName="Desksite_x0020_Folder_x0020_Link"
FieldType="SPFieldURL"
-->
<span dir="none"><span class="ms-formdescription">Type the Web address: (<a id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlControlId" href="javascript:TestURL('Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldUrl')" target="_self">Click here to test</a>)<br></span><input dir="ltr" type="text" value="http://Redirect.aspx?FID=2388721" id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldUrl" title="Desksite Folder Link" class="ms-long" style="ime-mode : "><br><span class="ms-formdescription">Type the description: <br></span><input type="text" maxlength="255" id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldDescription" title="Description" value="Open Client page" class="ms-long"><br></span>
</td>
</tr>
ASKER
I can see the individual IDs of the input controls, but nothing else referring to 'entire' control (both fields are part of the SPfieldURL control)
id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldUrl" id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldDescription"
After some further reading - using SharePoint's 'internal field ID' to hide a control of this type may not be possible, so will likely come down to hiding the 'individual' input fields. Unless there is another way to hide the whole control?
id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldUrl" id="Desksite_x0020_Folder_x0020_Link_57383366-b261-4a04-9645-65385ef30c0c_$UrlFieldDescription"
After some further reading - using SharePoint's 'internal field ID' to hide a control of this type may not be possible, so will likely come down to hiding the 'individual' input fields. Unless there is another way to hide the whole control?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help :-)
you're welcome!
for that, with Chrome for example, right click on the field itself, choose inspect
now on the left panel, your field should be selected, maybe you need to click on its parent to get the exact container you want to hide. you need a unique selector too else you can hide the wrong one
if you need more help, right click on a parent, click copy, copy outerhtml and paste it here