Is is just one specific field that fails?  Perhaps there's something
odd about the field's name (the way naming a Form field "submit" can
cause grief ... something Tapestry won't even try to do now).

This code has changed in 5.3 recently, to defer the lookup until an
error actually needs to be displayed.

On Tue, Jun 14, 2011 at 11:04 AM, Rich M <rich...@moremagic.com> wrote:
> Hi,
>
> an issue has recently been brought to my attention by QA, and I'm trying to
> unravel what is at play here.
>
> The core of the problem is that I have a form with validation on a page, and
> when this page is loaded in Safari (5.0.2), the error console appears at the
> top saying that the TapestryInitializer.validate method failed due to DOM
> Exception 12 syntax error on the validation hash built by Tapestry.
>
> After thorough debugging, I isolated the issue to a section of code from
> core.js, the code on line 7723 is failing with the DOM Exception 12 error.
> More specifically, it is the down method that fails when it calls
> findElements and the line 3301 fails in that, when calling the
> root.querySelectorAll(e) method. The value of e here is the same as selector
> variable except there is '#[object HTMLInputElement] ' appended to the front
>
> An example of the selector passed into the down method when it fails.
> selector = "label[for='name']"
> e = "#[object HTMLInputElement] label[for='name']"
>
> Has anyone encountered something similar before and found a way to deal with
> it? I've gotten pretty far in uncovering the issue, but I'm running out of
> ideas as to a remedy. The validation fails on the page as a result, which QA
> is deeming unacceptable. Strangely enough, I never reproduced this bug in
> FireFox, Chrome, or IE at any point.
>
> Below is the Associated Javascript.
>
> Thanks,
> Rich
>
>
> Tapestry.FieldEventManager = Class.create( {
> 7715
> 7716initialize : function(field) {
> 7717this.field = $(field);
> 7718
> 7719var id = this.field.id;
> 7720
> 7721var selector = "label[for='" + id + "']";
> 7722
> 7723this.label = this.field.up("form").down(selector);
> 7724this.icon = $(id + '_icon');
> 7725
> 7726this.translator = Prototype.K;
> 7727
> 7728var fem = $(this.field.form).getFormEventManager();
> 7729
> 7730if (fem.validateOnBlur) {
> 7731
> 7732document.observe(Tapestry.FOCUS_CHANGE_EVENT, function(event) {
> 7733/*
> 7734* If changing focus *within the same form* then perform
> 7735* validation. Note that Tapestry.currentFocusField does not
> 7736* change until after the FOCUS_CHANGE_EVENT notification.
> 7737*/
> 7738if (Tapestry.currentFocusField == this.field
> 7739&& this.field.form == event.memo.form)
> 7740this.validateInput();
> 7741
> 7742}.bindAsEventListener(this));
> 7743}
> 7744
> 7745if (fem.validateOnSubmit) {
> 7746$(this.field.form).observe(Tapestry.FORM_VALIDATE_FIELDS_EVENT,
> 7747this.validateInput.bindAsEventListener(this));
> 7748}
> 7749}
>
> findElements: function(root) {
> 3290root = root || document;
> 3291var e = this.expression, results;
> 3292
> 3293switch (this.mode) {
> 3294case 'selectorsAPI':
> 3295if (root !== document) {
> 3296var oldId = root.id, id = $(root).identify();
> 3297id = id.replace(/([\.:])/g, "\\$1");
> 3298e = "#" + id + " " + e;
> 3299}
> 3300
> 3301results = $A(root.querySelectorAll(e)).map(Element.extend);
> 3302root.id = oldId;
> 3303
> 3304return results;
> 3305case 'xpath':
> 3306return document._getElementsByXPath(this.xpath, root);
> 3307default:
> 3308return this.matcher(root);
> 3309}
> 3310}
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to