frequent
frequent

Reputation: 28513

what the correct synatax to use XMLFormat() in Coldfusion with input fields?

I'm sitting on a from trying the Coldfuion XMLFormat() function.

However if I do this:

<form name="sample" action="#cgi.script_name#" method="post">
    <input name="test" value="#XMLFormat( form.test )#" type="text" tabindex="1" />
</form>

I'm just getting CF-erors, that element test is undefined. What am I doing wrong?

Thanks for input!

Upvotes: 0

Views: 119

Answers (1)

Seybsen
Seybsen

Reputation: 15587

You need to check if form.test exists:

<form name="sample" action="#cgi.script_name#" method="post">
  <input name="test" value="<CFIF structkeyexists(form,"test")>#XMLFormat( form.test )#</CFIF>" type="text" tabindex="1" />
</form>

Upvotes: 1

Related Questions