My aim is for example if i select Item 1 and click save when i open the form or any user open the form the Item1 need to show as checked but should be in disable but the below code works as hide the selected values will hide can anyone help.Thanks
<script type="text/javascript" src="/IT/SiteAssets/jquery-3.1.0.min.js"> </script>
<script>
$( document ).ready(function() {
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('computer test')/Items", //THE ENDPOINT
method: "GET",
async:false,
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
var obj = data.d.results;
for(var i=0;i<data.d.results.length;i++)
{
hideval(obj[i].Title);
}
}
});
function hideval(title)
{
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Computer')/Items?$filter='"+title+"' eq Testing", //THE ENDPOINT
method: "GET",
async:false,
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
if(data.d.results)
{
if(data.d.results.length > 0)
$("span[title='"+title+"']").closest("tr").hide();
// $("span[title='"+title+"']").closest("tr").attr("disabled",true);
}
else
{
console.log(title);
}
}
});
}
});
</script>
Change
<?php if(isset($_POST['txt1'])) echo "checked='checked'"; ?>
To
<?php if(isset($_POST['txt1'])) echo "checked='checked' disabled='disabled'"; ?>
To check and disable textbox1 if previously checked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.