문제

From a best-practice or performance standpoint which option is best to use for testing if a FORM value is not blank?

<cfif NOT isNull(FORM.Forename)>

OR

<cfif Len(Trim(FORM.Forename)) GT 0>

OR

<cfif FORM.Forename NEQ "">

I don't want the value to be valid if it has something silly like 4 blank spaces in it. I guess 4 blank spaces is not technically a NULL value?

도움이 되었습니까?

해결책

The second

<cfif Len(Trim(FORM.Forename)) GT 0>

The first will not be null. Cf will receive an empty string or no form element. The third is covered by the second.

You may need to wrap the form element with an isdefined depending on the form element type.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top