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

Empty Entry Prevention

Guest
Mar 23, 2010 Mar 23, 2010

Copy link to clipboard

Copied

Essentially, here is what I want to happen:

Instead of making it a requirement to enter data into a textbox (cfinput), I want to make it so if there is an empty textbox, the entire form will not be entered into the database, but will act as though it were submitted (I know this sounds strange, but this is actually what needs to happen).

TOPICS
Database access

Views

553

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
Valorous Hero ,
Mar 23, 2010 Mar 23, 2010

Copy link to clipboard

Copied

Submit the form, then on the action page validate the values according the the business rules and chooe the appropiate branch for what happens to the data from two or more appropiate choices.

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 24, 2010 Mar 24, 2010

Copy link to clipboard

Copied

What's the part you are having trouble 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
Guest
Mar 24, 2010 Mar 24, 2010

Copy link to clipboard

Copied

Thank you both for your quick repsonses, however I have solved the problem.  What I did was put CFIF statements around each query stating that if the textbox was empty, it wouldn't run the query script.

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
Valorous Hero ,
Mar 24, 2010 Mar 24, 2010

Copy link to clipboard

Copied

LATEST

Ok, good.  That was pretty much what we where guiding you towards.

But separate if statements around each <cfquery...> block?  Are they all testing the same form field?  If so, wouldn't it be easier to have one at the beginning of the file that tests the field and then prevents the processing of any of the database code?  That's what I would have tried for.  I like writing less code whenever possible.

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