I think you can do like this:

if request.vars:
   use request.vars.varname to access values
else:
  return .....

Since you point your form to the right actions the all the vars will
be there when you submit.
When you dont submit they will not be there.

2012/2/4 Salvation <[email protected]>:
> Hi!
>    I have a html form in my default view. I don't want to create form
> elements from my controller, but use pure HTML where possible. How can
> I
> 1. Access the form elements, and their values into my controller, say
> default.py. (something like GetElementById )
> 2. Detect if the form has been submitted, so that I can use the values
> I Accessed.
>
> I went through many questions here, but couldn't work it out.
>
> My View:
>
> <form id="mainForm" class="well form-search">
>     <legend>Search Videos</legend>
>         <span class="input">
>              <input type="text" size="45" name="search_keyword"
> id="searchKeyword" class="xlarge">
>         </span>
>
>         <span class="formactions">
>                  <button class="btn primary" type="submit">Search</
> button>
>          </span>
> </form>
>
> My Controller:
>
> def index():
> #    is form submitted ?
> #    if Yes
> #        Access the form
> #        get the value inside the searchKeyword text box
> #        Use it elsewhere
> #    else
> #        display the form and wait
>
> I have a feeling that this is not the correct approach. Please feel
> free to point me in the right direction.
>
> Thank You.



-- 
Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

Reply via email to