if textbox value contains 'string' then set string readonly
Posted: Tue Nov 05, 2013 8:35 am
I have the following drop down list:
When the edit button is clicked the jobStatus textbox is shown.
When the Job Accepted option is selected it automatically gets passed to the jobStatus textbox to allow the user to edit the date and time if needed.
I am using the editStat() function to pass the value to the textbox here:
This works fine but although the user is able to edit the date and the time, they can also edit the actual status itself, in this case 'Job Accepted'. Which is not necessary, is there any way I can run a check to see if the value in the textbox contains 'Job Accepted' and then set 'Job Accepted' to read only so it cannot be edited.
Many thanks
Code: Select all
<td><label>Job Status:
</label></td>
<td><select onkeydown="return noesc()" id="JobStatus1" name="jobStatus1" onchange="editStat(this)">
<option value="Please Select">Please Select</option>
<option value="Job Accepted <?php echo $datestamp;?>" >Job Accepted <?php echo $datestamp;?></option>
</select> <input type="button" style="width: 60px; height: 30px;" id="edit1" value="Edit" onclick="show('JobStatus');"/>
<input type="button" style="width: 60px; height: 30px;" id="hide1" value="Hide" onclick="hide('JobStatus');"/>
<input onkeydown="return noesc()" style="width: 255px;" type="text" name="jobStatus" id="JobStatus"></td>
</tr>When the Job Accepted option is selected it automatically gets passed to the jobStatus textbox to allow the user to edit the date and time if needed.
I am using the editStat() function to pass the value to the textbox here:
Code: Select all
function editStat(data)
{
document.getElementById("JobStatus").value = data.value;
}Many thanks