English 中文(简体)
Dojo Valid 文本Area widgets在无效时得到了强调?
原标题:How do Dojo ValidationTextArea widgets get highlighted when invalid?

我试图制造一种习俗,即ValidationTextBox继承的Dojo Validation IdBox。 我的习俗植被将加上一个后端服务器的“合成”重复识别。

页: 1 ValidationTextBox, 并修改了两种方法:Valid()和验证()。 然而,我无法得到验证,以充分开展工作。 植被赶上,并着重指出缺少所需投入等问题。 甚至当有重复的ID(工具似乎)时,它也会赶上,但未能像预期的那样突出该领域。

我试图用下文简化的法典来孤立我的问题。 大部分是《Dojo法》的原产地,略有改动。 我的一般战略是让植被验证为一种固定的ValidationTextBox,然后测试一个重复的ID。 我修改了Valid()两种模式:便衣鉴定和验证,独一无二。 目前,独一无二的检验总是故意失败。

同样,我修改了(......)验证其正常工作,如果正常的验证成功,但独一无二的验证失败,则做一些额外的处理。 我试图反映与ValidationTextBox处于状态时相同的逻辑,但同样的效果并未反映: ID没有现成工具,但带有外壳标志的红色提纲没有出现。

I examined ValidationTextBox s code, but I cannot figure out how that special styling is triggered... can someone explain how ValidationTextArea works? Specifically I m not quite sure how this._maskValidSubsetError, aria-invalid, and this.state are used.

(有时,我只想看到这个工具,而不要 red。) 如同在AJAX重复要求处理时显示的情况一样。

// If ValidationTextBoxValidates
isValid: function(isFocused, requireUnique) {
    if (typeof requireUnique ===  undefined ) requireUnique = false;

    var isValid = this.inherited(arguments);
    var isUnique = false;

    return (requireUnique ? (isValid && isUnique) : isValid);
},

validate: function(/*Boolean*/ isFocused){
    // summary:
    //        Called by oninit, onblur, and onkeypress.
    // description:
    //        Show missing or invalid messages if appropriate, and highlight textbox field.
    // tags:
    //        protected
    var message = "";
    var isValid = this.disabled || this.isValid(isFocused);
    if(isValid){ this._maskValidSubsetError = true; }
    var isEmpty = this._isEmpty(this.textbox.value);
    var isValidSubset = !isValid && isFocused && this._isValidSubset();
    this._set("state", isValid ? "" : (((((!this._hasBeenBlurred || isFocused) && isEmpty) || isValidSubset) && this._maskValidSubsetError) ? "Incomplete" : "Error"));
    this.focusNode.setAttribute("aria-invalid", isValid ? "false" : "true");

    if(this.state == "Error"){
        this._maskValidSubsetError = isFocused && isValidSubset; // we want the error to show up after a blur and refocus
        message = this.getErrorMessage(isFocused);
    }else if(this.state == "Incomplete"){
        message = this.getPromptMessage(isFocused); // show the prompt whenever the value is not yet complete
        this._maskValidSubsetError = !this._hasBeenBlurred || isFocused; // no Incomplete warnings while focused
    }else if(isEmpty){
        message = this.getPromptMessage(isFocused); // show the prompt whenever there s no error and no text
    }

    /// Begin custom widget code
    if (isValid && !this.isValid(isFocused, true) ) {
        isValid = false;

        var isValidSubset = !isValid && isFocused && this._isValidSubset();

        this._maskValidSubsetError = isFocused && isValidSubset; // we want the error to show up after a blur and refocus
        message =  ID not available ;

        this.focusNode.setAttribute("aria-invalid", isValid ? "false" : "true");
    }
    /// End custom widget code

    this.set("message", message);
    return isValid;
},
最佳回答

可能遗漏了电线和安放云中的明显、隐蔽的;& >;)

混凝土/混凝土机制的一个要点是,该工具只能出现在目前显示的盒子上,因此,_maskValid

您是否尝试了this.set(状态),这本准则是:?

植被是国有的,set可能只是trick、 firing或发表专题。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.