Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top