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 8305807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:12:02+00:00 2026-06-08T18:12:02+00:00

TALES expression is new to me. Can I get some good reference for the

  • 0

TALES expression is new to me. Can I get some good reference for the same? Actually I wish to define a content rule for numeric input field using ploneformgen. Something like:

python: request.form.get('amt', False) <= 5000     

then apply the rule.

Here ‘amt’ is a numeric/whole number field on the input 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-08T18:12:04+00:00Added an answer on June 8, 2026 at 6:12 pm

    For reference, you should look at the official TALES specification, or refer to the TALES section of the Zope Page Templates reference.

    In this case, you are using a plain python expression, and thus the normal rules of python code apply.

    The expression request.form.get(‘amt’, False) would return the request parameter 'amt' from the request, and if that’s missing, return the boolean False, which you then compare to an integer value.

    There are 2 things wrong with that expression: first of all you assume that the 'amt' parameter is an integer value. Even a PFG integer field however, is still a string in the request object. As such you’ll need to convert in to an integer first before you can compare it.

    Also, you fall back to a boolean, which in integer comparisons will be regarded as the equivalent of 0, better be explicit and use that instead:

    python: int(request.form.get('amt', 0)) <= 5000
    

    Note that for a PFG condition, you can also return a string error message instead of boolean True:

    python: int(request.form.get('amt', 0)) <= 5000 or 'Amount must be not be greater than 5000'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a StackPanel and for some reason I can't get the content of
I'm working with an expression within a moq-ed Get Service and ran into a
I'm new to LINQ, and (sadly) i need to convert some messed sql command
I'm new to LINQ and am finding it a bit difficult with understanding some
My app is using htmlagility pack. As of right now I can get all
I have this fragment of code: SmsDataClassesDataContext dc = new SmsDataClassesDataContext(); // Get the
I can't get the QueryObjectGraph to add INCLUDE child tables if my life depended
I'm trying to build an expression tree for this linq query: so I can
I want to take a math expression that takes variables and print (assign to
Two tables. I have column a (datetime type) and column b (numeric type) in

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.