How to Set fields as Readonly

117 Views Asked by At

I have added two fields [ Start_date and End_Date] in Project , can able to update and save values in the fields. I want to allow fields editable when EDIT button clicked otherwise it should be readonly.

Code changes but doesn't works

<label for="txtstartdate"><?php echo __("Start Date")?> <span class="required">*</span></label>
<input id="txtstartdate"  name="txtstartdate" type="text"  class="formInputText" disabled="disabled" value="<?php echo $project->getstartDate()?>" disabled /> 
<br class="clear"/>

function disableWidgets(){
$('#addProject_start_date').attr('disabled','disabled');
$('#addProject_end_date').attr('disabled','disabled');
}

function enableWidgets(){
$('#addProject_start_date').removeAttr('disabled');
$('#addProject_end_date').removeAttr('disabled');
}

In which file i have to change . Any one could help me to achieve this?

0

There are 0 best solutions below