Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Text field Form validation based on drop down option

New Here ,
Mar 24, 2009 Mar 24, 2009
Hi

I need some help please!

I have a form that is collecting preferred mailing address information - (drop down to select home or work then text fields for the actual home and work address data).

If the person selects their preferred mailing address is home - I need those specific text fields to require entry. And vice versa with the work address fields if they select that work is their preferred address.

Does any one have any suggestions on doing this - either with cold fusion, javascript, cfform? Help please!!

Thank you!
TOPICS
Advanced techniques
671
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2009 Mar 24, 2009
Use javascript. I learned by buying the book, Teach Yourself Javascript in 24 Hours.

Or, you could use a combination of cfsavecontent, cfform, and div, javascript. It will enable you to use the required attribute of cfinput.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2009 Mar 25, 2009
HI Dan,
Thank you for the advice. Could you provide a little more detail?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 25, 2009
The concept is like this:

<cfsavecontent variable="x">
cfinput tags etc
</cfsavecontent>

<cfsavecontent variable="y">
different cfinput tags etc
</cfsavecontent>

<script>
<cfoutput>
use toscript() to convert x and y to js variables
</cfoutput>
function to change the value of your div
</script>
<cfform>
<select call your function with the onChange attribute>
<cfoutput>
<div id="something">
#x#
</div>
etc
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2009 Mar 25, 2009
Hi, Thank you for the info - but that is a bit over my head. I realize i posted this question in the advanced section - but i am not that advanced of a coder. I was hoping someone might have an example of something already.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 25, 2009
LATEST
I do but I don't like spoon feeding people. What specific parts of my earlier posts did you have difficulty with?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources