Select the value of the input box to judge, when the value is 0, 0=='' is true?

It is necessary to judge the value of the selection input box, and perform business verification according to different selection situations.

When the selection input box is selected, 0-unlock 

Judging 0=='' turned out to be true. Cause the prompt is wrong, please select the operation! The choice has actually been made.



 jsp code

<tr>
				
				<td class="td_right"><span class="required">*</span>锁定状态:</td>
				<td> <cw:text property="treatment_bie029" readOnly="true"  id="treatment_bie029"  > </cw:text>
					<%-- <cw:combobox id="treatment_bie029" property="ac63.bie029" readOnly="true"
								listeners="{'check':changeBie029}"  forceSelection="true"/> --%>
				</td>
				<td class="td_right"><span class="required">*</span>请选择操作</td>
				<td><cw:combobox id="bie029" property="bie029"
								data="[[0,'unlocked'],[1,'locked'],[-1,'unselected']]" value="-1" forceSelection="true"/> </td>
			<td class="td_right">Lock Reason:</td>
				<td><cw:text property="biz005" ></cw:text> </td>
			</tr>

javascript code

alert(bie029);//0
		alert(bie029==null);//false
		alert(bie029 == '');//true ????
		alert(bie029 == '-1');//false
		if (bie029 == null || bie029 == ''|| bie029 == '-1') {
			Wonders.Msg.info('Friendly reminder: Please select an operation first!', 'Tips', function() {
			
			});
			return;
		}

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326982391&siteId=291194637