{"id":140,"date":"2018-02-12T11:13:57","date_gmt":"2018-02-12T11:13:57","guid":{"rendered":"http:\/\/4us2use.at\/?p=140"},"modified":"2018-03-09T12:15:02","modified_gmt":"2018-03-09T12:15:02","slug":"disable-form-field-by-using-jquery","status":"publish","type":"post","link":"http:\/\/4us2use.at\/?p=140","title":{"rendered":"Disable Form Field by using jQuery"},"content":{"rendered":"<p>Problem Description:<\/p>\n<p>Usually you disable fields on forms by using SP Designer.<br \/>\nBut if it&#8217;s a site content type, you can&#8217;t do it this way &#8211;&gt; use a piece of Javascript<\/p>\n<p>Resolution:<\/p>\n<p>1. Download a jqueryxx.min.js file and place it in e.g. Site Assets library.<\/p>\n<p>2. On the list settings choose the form web part you want to manipulate.<br \/>\nThen add a script web part and add following code (the correct title of the field you may find by inspect the element in the browser).<\/p>\n<p>&lt;script src=&#8221;http:\/\/PathToYourjQueryFile\/jquery-xx.min.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\n$(document).ready(function()<br \/>\n{<br \/>\n$(&#8220;input[Title=&#8217;YourFieldTitle&#8217;]&#8221;).attr(&#8220;disabled&#8221;, &#8220;disabled&#8221;);<br \/>\n});<br \/>\n&lt;\/script&gt;<\/p>\n<span id=\"post-ratings-140\" class=\"post-ratings\" data-nonce=\"5c4d29b0ea\"><img id=\"rating_140_1\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"1 Star\" title=\"1 Star\" onmouseover=\"current_rating(140, 1, '1 Star');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_140_2\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"2 Stars\" title=\"2 Stars\" onmouseover=\"current_rating(140, 2, '2 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_140_3\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"3 Stars\" title=\"3 Stars\" onmouseover=\"current_rating(140, 3, '3 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_140_4\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"4 Stars\" title=\"4 Stars\" onmouseover=\"current_rating(140, 4, '4 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_140_5\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"5 Stars\" title=\"5 Stars\" onmouseover=\"current_rating(140, 5, '5 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/> (No Ratings Yet)<br \/><span class=\"post-ratings-text\" id=\"ratings_140_text\"><\/span><\/span><span id=\"post-ratings-140-loading\" class=\"post-ratings-loading\"><img src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/loading.gif\" width=\"16\" height=\"16\" class=\"post-ratings-image\" \/>Loading...<\/span>\n","protected":false},"excerpt":{"rendered":"<p>Problem Description: Usually you disable fields on forms by using SP Designer. But if it&#8217;s a site content type, you can&#8217;t do it this way &#8211;&gt; use a piece of Javascript Resolution: 1. Download a jqueryxx.min.js file and place it in e.g. Site Assets library. 2. On the list settings choose the form web part &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/4us2use.at\/?p=140\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Disable Form Field by using jQuery&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/140"}],"collection":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=140"}],"version-history":[{"count":2,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions"}],"predecessor-version":[{"id":148,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions\/148"}],"wp:attachment":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}