To solve the problem that jquery does not pass a value to the disabled attribute, jquerydisabled
Question: After an uneditable judgment is added to the review page, click review. An error is reported, and the data in the form is not passed.
The following is the code added to js to determine whether it is on the review page. Remove the code and click the [review] button to transfer data normally. If it is added, it cannot be passed.
if (data.WF_W_STATUS > 0 && data.WF_W_STATUS != 2) { $('input,textarea').attr("disabled", "disabled"); }
Details:
In the form, if you add attributes such as disabled = "disabled" or disabled = "true" to the input, the value is not transferred to the background when the form is submitted.
Cause: If the disable attribute is added to an element on the HTML page, this element is only displayed to the user. When the form is submitted, this element is not submitted to the background for processing. therefore, when an element is added with the disabled attribute, the value of this attribute cannot be obtained in the background.
Solution: Write another hidden attribute, one for display, and the other for passing values.
Processing Method:
1. First remove the input in js and change it to: input [type = text]. This is only used to hide the types of text and textarea,
(data.WF_W_STATUS > 0 && data.WF_W_STATUS != 2) { $(':input[type=text],textarea').attr("disabled", "disabled"); }
Add hidden fields to the submitted form.
<input type="hidden" id="XSBH" name="XSBH" /> <input type="hidden" id="WORKFLOWID" name="WORKFLOWID" /> <input type="hidden" id="WF_W_STATUS" name="WF_W_STATUS" /> <input type="hidden" id="WF_T_NODENAME" name="WF_T_NODENAME" /> <input type="hidden" id="WF_T_AUDITNAME" name="WF_T_AUDITNAME" /> <input type="hidden" id="WF_T_AUDITSTATE" name="WF_T_AUDITSTATE" />
Put it in a form and make the form submit a hidden type when submitting the form. However, you must note that if you load the value before and after disabled, it will overwrite it.