Form question


every 2 years have create web form people submit online nominations transportation awards.  every time create it, think i'll able reuse next time, ends changing (the questions, security requirements, etc) end having more half of over.

 

the form has js validation fields data type, max length, etc, has serverside validation.  if submit form js disabled , there's error, form reloads (populated data entered) , displays error messages telling what's wrong, can edit data , resubmit.

 

it's large form, don't want have more 1 copy of it, single copy has to:

 

1) new (blank) form.

2) form gets populate database when people want edit existing nomination.

3) retain information entered when there's error.

 

the way i've been doing <cfparam> form data values of inputs:

 

value="#iif(form.nominator_org neq "",de(form.fieldname),de(query.fieldname))#"

 

if form variable has value, use it, otherwise use value query.  needless say, bit clunky, wondering if there cleaner way.  there on 40 fields, ends being lot of code!

iif , de aren't used these days in cf. 

 

are form fieldnames same query columns?  if like:

 

if using query

  set studata = yourqueryname

else

  set studata = form

/if

 

then refer like:

<input type="text" value="<cfif len(studata[fieldname])>#studata[fieldname]#</cfif>" />



More discussions in ColdFusion


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account