changing default value for a hidden column will set it as Optional

Sometimes you are faced with problems that you can not understand . Now I have a hidden column inside my Issue tracking list, which is used to store a series of string to be read by the list workflow. now i set a defualt value for the column such as "ABC", and i set it as a hidden field, so user will not be able to modify its value or see it. but the problem is that if admin users chnage the defualt value of the hidden field from the "List Option>> List Setting >> Columns >> click on the hidden column", then its type inside the content type will be changed from hidden to optional and the field will appear inside the New and edit forms ,, so can any one adivce on this please? is there a way to prevent the hidden column from being set as optional when its defualt value is changed ?

Thanks

May 29th, 2015 6:19am

hi john,

we can't prevent the way as the admin have all the right to change the field, so instead of setting the field as hidden you can use an ordinary  field an you can hide it in new, edit,display page using JavaScript you can also set values through Jquery from the page. kindly consider this as a suggestion.

regards

Anandakrishnan

Free Windows Admin Tool Kit Click here and download it now
May 29th, 2015 7:01am

hi john,

we can't prevent the way as the admin have all the right to change the field, so instead of setting the field as hidden you can use an ordinary  field an you can hide it in new, edit,display page using JavaScript you can also set values through Jquery from the page. kindly consider this as a suggestion.

regards

Anandakrishnan

the problem is not related that admin can do what they want , the problem is that if you set a column as hidden from the content type settings, then you changed the defualt value of the column ,, it will then be set as optional,, this is the problem

second question , what is the formal way to hide column from new and edit forms using Jquery? should i inspect the related markup and hide them accordingly ?

May 29th, 2015 7:39am

hi John,

1.if the user have permission to edit settings of list then you cannot prevent that.

2.you have inspect element after its is generated in the browser and using Jquery you can hide that (have to create content editor web part and place the Jquery code)

or

you can create pages from SharePoint designer, in the designer you can locate the element it would be placed inside

tr and td, assign some custom id to them and using that id you can hide the fields form the page.

I think you might aware of these things already.i hope this may help you.

Regards

Anandakrishnan

Free Windows Admin Tool Kit Click here and download it now
May 29th, 2015 8:16am

hi John,

1.if the user have permission to edit settings of list then you cannot prevent that.

2.you have inspect element after its is generated in the browser and using Jquery you can hide that (have to create content editor web part and place the Jquery code)

or

you can create pages from SharePoint designer, in the designer you can locate the element it would be placed inside

tr and td, assign some custom id to them and using that id you can hide the fields form the page.

I think you might aware of these things already.i hope this may help you.

Regards

Anandakrishnan

Ok now i got this column which will keeps showing after changing its default value, the name is "Item Number", and here is part of the markup :-

<table width="100%" class="ms-formtable" style="margin-" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="113" class="ms-formlabel" nowrap="true" valign="top">
<h3 class="ms-standardheader">

<nobr>Item Number</nobr>

</h3></td>


<td width="350" class="ms-formbody" valign="top">

<span dir="none"><input title="Item Number" class="ms-long ms-spellcheck-true" id="_x0049_D1_806a702b-1716-47f5-a93c-16067f502daf_$TextField" type="text" maxlength="255" value=""><br></span>

<span class="ms-metadata">Do not customize at the list level</span>


</td></tr>

so i wrote the following script to hide the whole TR:-

<script>
$( document ).ready(function() {

                             
    $('.ms-formtable table').each(function () {
    $(this).find('tr').each(function () {
               var str_text = $(this).find('td nobr').text();
               // console.log(str_text);
               if (str_text == 'Item Number') {
               $(this).hide();    
               } 
        
    });

});   

});
</script>

but this did not hide any thing..


May 29th, 2015 10:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics