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

Text field Form validation based on drop down option

New Here ,
Mar 24, 2009 Mar 24, 2009

Copy link to clipboard

Copied

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

Views

655

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

HI Dan,
Thank you for the advice. Could you provide a little more detail?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST
I do but I don't like spoon feeding people. What specific parts of my earlier posts did you have difficulty with?

Votes

Translate

Translate

Report

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
Documentation