let me just add that hidden fields are added to the form when it is
serialized

{{=form}}

not before. This is why you cannot access the error DIV
programmatically.

But you can form.error.clear() before {{=form}} in order to remove
them and take an alternate action.

Massimo


On Nov 14, 7:42 pm, "Yarko Tymciurak" <[EMAIL PROTECTED]> wrote:
> Wes -
> Forgive the long answer here - feel free to skip it if you like.
>
> I like to just think about what's happening, and how this works, and sort of
> where and in what order:
>
> Let's work backwards:
>
> The code to generate a page from the template happens last.
> That means everything else has run, and all the variables are now set...
> From the perspective of the rendered page, all that underlying web2py code
> (and therefore
> variables) is "static" at this instance.
>
> The exception is the Ajax & jQuery code - but that runs out on the browser;
> to keep things simple, think of it as not interacting w/ the server, at
> least not in the context of "this" page (anything that does get sent back
> will trigger a new rendering).
>
> Ok - so what do you have?
>
> You have component strings, called "flash", that carry a message.  By
> convention, they are specially treated in code (including rendering code).
>
> Now - if this "static" data (remember, I'm talking slow-motion: the time
> slice of a single rendered page) -  .flash - exists, the default layout.html
> code does something with it.  (I am  looking at
> applications/admin/views/layout.html).
> One thing layout does is, when it decides to render the .flash variable,
> wrap it in a DIV class (you guessed it - "flash"), which puts it under the
> influence of styles.css, line 80 (I think), which web2py_ajax.html lines
> 26,27 have something to say about.   That's where we get slide-down and
> colors.
>
> The template ( layout.html) is where we get the display logic to check the
> controller variable.
>
> To display a variable (.flash  for example)  the template checks if there's
> a condition (is it set in the case of flash), and wraps it in that "flash"
> DIV - which client side code acts on (.css and ajax).
>
> If your view is setting variables only used on client side, you're good....
>
> That's basically how I think of it.
>
> Now, all you need to do is think presentation:   what condition from the
> client (controller / model) do I want to check, and what presentation (view)
> response will I build from it?
>
> Hope that was helpful.
>
> Kind regards,
> Yarko
>
> On Fri, Nov 14, 2008 at 5:56 PM, Wes James <[EMAIL PROTECTED]> wrote:
>
> > Ok i've worked with
>
> > <tr><td>
> > <label>{{=db.student.code.label}}</label><br>
> > <input name="code" value="{{=form.latest.code}}" size=31 maxlength=30 />
> > {{if form.errors.code:}}{{=form.errors.code}}{{pass}}
> > </td></tr>
>
> > and that provides an error on code if someone tries to put a duplicate
> > code (needs to be unique).
>
> > If I just use {{include}} to build all the fields in a table and it is
> > an error there is a red "flash" error on the code field.
>
> > How do I duplicate the flash on an error, as with the {{if
> > form.errors.code:....}} is not obvious enough when an error happens.
>
> > I tried:
>
> > {{=form[0][4]}}
>
> > to get the whole component in and see if that works, but it does
> > provide any error feedback.
>
> > How is the red flash error done?
>
> > thx,
>
> > -wj
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to