[albatross-users] setting value field
Michael C. Neel
neel at mediapulse.com
Thu Jun 26 00:06:59 EST 2003
> I've just been doing something like this:
>
> if ctx.has_value('submit'):
> # do the submit stuff
> elif ctx.has_value('cancel'):
> # do the cancel stuff
>
> etc...
>
> Where 'submit' or 'cancel' or what have you is the name
> of the submit-type
> form element.
>
> I don't see any downside to this technique?
The difference between req_equals and has_value is slight, but can catch
you off guard.
for req_equals to be true there must exists that name in the ctx.lcoals
AND it must have been submitted in the last request.
has_value checks is true only if the name exists in the ctx.locals
namespace.
So has_value can come from stored session data; req_equals must be in
the form. You're probably not going to do a
ctx.add_session_vars('submit'), so in pratice they can both be used for
this kind of work.
Mike
More information about the Albatross-users
mailing list