[albatross-users] ctx.req_equals() question.

Michael C. Neel neel at mediapulse.com
Wed Nov 27 12:32:37 EST 2002


Replying to this because I haven't heard anything about the below, and
also I've noticed another req_equals issue.  It seems if you use an
input of type="image" the name will not be set in req_equals, i.e.

	ctx.req_equals("mybutton") 
	
	will return false while

	dir(ctx.locals).has_key("mybutton")
	
	will return true

Mike

> -----Original Message-----
> From: albatross-users-admin at object-craft.com.au
[mailto:albatross-users-
> admin at object-craft.com.au] On Behalf Of Michael C. Neel
> Sent: Monday, November 18, 2002 11:06 AM
> To: albatross-users at object-craft.com.au
> Subject: [albatross-users] ctx.req_equals() question.
> 
> From the docs, req_equals() returns whether or not the browser request
> contains a non-empty field with a name which matches the name
argument.
> But I've noticed that if you leave a field blank on a form, submit it,
> have it return to the same form and submit it again, req_equals will
be
> true for the empty field.
> 
> In my case I have and edit account page to update your account.  On
the
> page is a change password / confirm password set of inputs.  If they
are
> empty I don't want to wipe out the users password, just up date the
> contact info.  The second submission will however wipe out the
password.
> To prevent this, my code looks like this:
> 
> 	if ctx.req_equals("password") and ctx.req_equals("confirm"):
> 		if ctx.locals.password == ctx.locals.confirm and
> len(ctx.locals.password) != 0:
> 			# change password
> 
> It would seem to me that the "and len(ctx.locals.password) != 0"
should
> not be needed.  I don't know if this is intended or not, I could be
> missing something about the intended use of req_equals().
> 
> Mike
> 
> 
> _______________________________________________
> Albatross-users mailing list
> Albatross-users at object-craft.com.au
>
https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users




More information about the Albatross-users mailing list