Closed GoogleCodeExporter closed 8 years ago
Has been discussed:
http://groups.google.com/group/recaptcha/browse_thread/thread/f4ce9cab3ac52bf
Original comment by adrian.g...@gmail.com
on 23 Jan 2011 at 3:53
This is a defect in the product. I see that you have discussed it and dismissed
it but that doesn't solve the problem. A well made form in asp.net webforms
should use ValidationGroup to protect it from clashing with other form elements
on the page.
This could be as simple as a search box with a requiredfield validator. It does
not mean that we would want to add multiple recaptcha's to a single page which
I agree would be confusing.
I understand that your stated reason is that the control implements IValidator.
It seems to me that this means it was not the correct class to start with as it
doesn't support the expected features for an asp.net webforms validator.
If you are stuck with the current implementation would it not make sense to
wrap that code up in a control which implements the validationgroup?
I don't mean to attack your work, which is a great asset to the community, I
just don't think this is a fringe use-case that should be just dismissed.
Original comment by w...@dbsinternetmarketing.co.uk
on 18 Apr 2011 at 10:06
ASP.NET BaseValidator implementation is built in a way that it expects the
following controls:
- an input to validate (ControlToValidate)
- a label that will show the error message (the validator control itself)
reCAPTCHA has both controls but the creation is outside developers' control.
The controls are built by a JS loaded from a script tag. What we actually have
as a reCAPTCHA Validator now is only a literal control that will load the
script tag (instead of an input and a label, see above).
It is not impossible if you want to create your own implementation that is
based on BaseValidator (instead of IValidator). Do note that the class
hierarchy will change a lot and you will end up with:
- an unused label control,
- that will not validate any external input control,
- and is written as a script tag (instead of divs like regular label).
The above doesn't look like a BaseValidator at all (a label without a label, a
validator without a field to validate), so I decided against using it and chose
a basic IValidator instead. This fringe use-case has been discussed and there
is already a simple workaround.
Original comment by adrian.g...@gmail.com
on 18 Apr 2011 at 3:35
Yeah I have been thinking this over since I posted this earlier today. Thanks
for getting back to me by the way.
It seems to me that the actual Recaptcha control should be considered as a
normal input control and then there should be an additional RecaptchaValidator
control which validates that Recaptcha control.
The RecaptchaValidator would implement BaseValidator. It would have a
ControlToValidate that you point at the Recaptcha control. It would support
ValidationGroup out of the box. It would provide the client and server side
functionality of a RequiredFieldValidator to ensure the validator is populated.
In addition it would have serverside validation which would query the Recaptcha
control to detect if the captcha was entered correctly. If it failed then it
would be responsible for displaying a default error message, a custom error
message via Text property and also play ball with the ValidationSummary control
via the ErrorMessage property.
I haven't totally understood what you are saying about implementing the current
control as a BaseValidator / IValidator but looking at it the way I have
described above could this be coded? Or is there some block with implementing
it this way?
Original comment by kingdoms...@dbshosting.co.uk
on 18 Apr 2011 at 4:11
Creating your own textboxes etc is totally possible, but:
1) you will have to make sure that you know how to retrieve challenges
2) you will have to create custom controls/input fields (instead of calling
recaptcha JS file)
3) you will have to create custom validation logic based on your input fields
4) you will have to style copy recaptcha stylesheet (optional)
The resulting code would be way too far from the documented APIs and will
confuse users. The sample library code here is provided for intermediate users
who wants to start learning/using reCAPTCHA.
Original comment by adrian.g...@gmail.com
on 18 Apr 2011 at 8:42
Original issue reported on code.google.com by
david.de...@outlook.com
on 4 Jan 2011 at 1:13