Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:14:54+00:00 2026-06-07T00:14:54+00:00

I have a fairly simple web2py form with a few validators like, IS_FLOAT_IN_RANGE(…) on

  • 0

I have a fairly simple web2py form with a few validators like, IS_FLOAT_IN_RANGE(…) on its fields. When I try to submit the form when it has fields which don’t pass validation the form will fail the first validation, but will not report there were any errors. If I then resubmit the same form, validation will fail once again.

Worse, if I submit valid information, it will not submit unless I submit the same form twice. The view is simply {{=form}}

The controller looks like this:

@auth.requires_login()
def addpipelines():
    form = FORM(INPUT(_name="type", _value="insert", _type="hidden"),
            INPUT(_name="project", _value="Project", requires=IS_NOT_EMPTY()),
            INPUT(_name="value", _value="Value", requires=IS_FLOAT_IN_RANGE(-1e100, 1e100)),
            BR(), BR(),
            INPUT(_type="submit", _value="Add"),
           _method="POST")

    if request.post_vars.type == "insert" and form.process().accepted:
       request.post_vars["blub"] = "blargh"

    return dict(form=form)

“`

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:14:55+00:00Added an answer on June 7, 2026 at 12:14 am
    if request.post_vars.type == "insert" and form.process().accepted:
    

    Note, in Python, the part of the above expression after the and will not be evaluated when the part before the and is false, so form.process() will only get called when the form is submitted. However, for form processing to work properly, form.process() must also be called when the form is first created (because it adds a hidden _formkey field and checks its value with a copy of the formkey placed in the session in order to protect against CSRF attacks and double submission). Instead, try switching the order of the conditions:

    if form.process().accepted and request.post_vars.type == "insert":
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple python loop that calls a few functions, and writes
I have a fairly simple math operation I'd like to perform on a array.
I have a fairly simple form: <asp:FormView> <EditItemTemplate> <asp:LoginView> <RoleGroups> <asp:RoleGroup roles=Blah> <ContentTemplate> <!--
I have fairly simple layout, like this: <div class=card> <span class=attack>1</div> <span class=defence>2</div> </div>
I have a fairly simple Windows Forms application that I would like to add
I have a fairly simple if else statement in C# that looks something like
I have this fairly simple form: <form action=...> <div> <input type=text class=input-text value= name=text
I have a fairly simple form with a checkbox, and I noticed that my
I have a fairly simple MFC app that just defines its own sub-classes of
I have a fairly simple question that has me stymied. I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.