formencode

Pylons FormEncode with an array of form elements

I have a Pylons app and am using FormEncode and HtmlFill to handle my forms. I have an array of text fields in my template (Mako) <tr> <td>Yardage</td> <td>${h.text('yardage[]', maxlength=3, size=3)}</td> <td>${h.text('yardage[]', maxlength=3, size=3)}</td> <td>${h.text('yardage[]', maxlength=3, size=3)}</td> <td>...

formencode invalid return type

if an exception occurs in form encode then what will be the return type?? suppose if(request.POST): formvalidate = ValidationRule() try: new = formvalidate.to_python(request.POST) data = Users1( n_date = new['n_date'], heading = new['heading'], desc = new['desc'], link...

Chain FormEncode Validators

Problem: I have a form in TurboGears 2 that has a text field for a list of e-mails. Is there a simple way using ToscaWidgets or FormEncode to chain form validators for Set and Email or will I have to write my own validator for this? ...

Decoding query strings in PHP

Okay, so I've written a REST API implementation using mod_rewrite and PHP. I'm accepting a query string via the body of HTTP DELETE requests (... collective groan?). Arguments about the wisdom of both previous statements aside, what I've found is that PHP doesn't automatically parse the request body of DELETE requests (i.e. $_POST is e...

FormEncode, pylons, and mako example

I'm working in pylons with mako, and I'd like to create forms and validations with FormEncode for several parts of my application. I can't seem to find any good examples of the whole process. My question is twofold: Technical FancyValidators and Schemas - Their relationship and syntax Pylons controllers and mako templates - how ...

Pylons/Formencode With Multiple Checkboxes

Hi Stackoverflow! I ran up against a few problems with Pylons/Formencode today when it came to validating multiple checkboxes. As a bit of background I have something like this in my Mako template: <input type="checkbox" name="Project" value="1">Project 1</input> <input type="checkbox" name="Project" value="2">Project 2</input> <input ...

Sqlalchemy query not commiting

Hi, I'm trying to create a simple unique username function for use in a Formencode schema. Here is the function: class UniqueUsername(formencode.FancyValidator): def _to_python(self, value, state): user = DBSession.query(User.user_name).filter(User.username==value) if user is not None: raise form...

Pylons FormEncode @validate decorator pass parameters into re-render action

I am attempting to use the validate decorator in Pylons with FormEncode and I have encountered an issue. I am attempting to validate a form on a controller action that requires parameters, and if the validation fails, the parameters aren't passed back in when the form is re-rendered. Here's an example. def question_set(self, id): ...

Using Pylons validate and authenticate_form decorator

The validate and authenticate_form decorators don't seem to play nice together. This is my template: <html> <title>Test</title> <body> ${h.secure_form('/meow/do_post')} <input type="text" name="dummy"> <form:error name="dummy"><br> <input type="submit" name="doit" value="Do It"> ${h.end_form()} </body> </html> And this is the controll...

Should I use in this case post or get method for ajax form submission?

Hi, Should I use in this case method="post" or method="get" for ajax form submission? Update: When should be used post and when get in case of ajax form submission? <form action="script.php" method="post"> <label>Url: </label> <input value="http://" id="url-input" type="text" size="100" /><br /> <label>paste html file source: ...

How to render HTML form from schema using formencode?

I'm using formencode for validating and submitting forms in my Pylons application. The documentation says that it can be used also for generating forms, but there is no any example. I even found the old topic which says it can be done with form = HTMLForm(form_template, FormSchema) form.render() but for the latest version of formenco...

Pylons formencode - How do I POST an array of data?

I have a form that is similar to the following: Enter Name: Enter Age: [add more] That add more field copies the Name and Age inputs and can be clicked as many times as the user wants. Potentially, they could end up submitting 50 sets of Name and Age data. How can I handle this received data when it's posted to my Pylons application?...

Passing state when using decorators (formencode) in pylons

I've met the same problem as this page: http://www.mail-archive.com/[email protected]/msg14292.html This is the main content from there: I am using formencode to validate my forms, and I've stumbled upon a problem. When using tha validator inside the controller action, I call to_python() and I can pass the sta...

Using Both jQuery And FormEncode To Validate Forms Without Repetition

I'm working on a Pylons-based web app. Because I am sane, I am using jQuery (and plugins) instead of writing raw JavaScript. I am also using FormEncode to validate forms for my app (especially new user registration). FormEncode is great for validating forms after they're submitted. jQuery, when JavaScript is available, validates form...

Error when the Email formencode validator

Hello, I wanted to create an IDN-aware formencode validator to use in one of my projects. I used a portion of code from the Django project (http://code.djangoproject.com/svn/django/trunk/django/core/validators.py) to do that, but there must be a trivial error in my code I can't find : class Email(formencode.validators.Email): def _...

FormEncode validate: words divided by a comma

Hi everyone ! How to validate words divided by a comma by FormEncode ? Something like this: "foo1, foo2, foo3" -> ["foo1", "foo2", "foo3"] ...