ValidationRuleRequiredAttributeValue.MatchAttributeName Property
Gets or sets an additional attribute name that must be found in the HTML tag containing the attribute value to validate. Used in conjunction with MatchAttributeValue.
Namespace: Microsoft.VisualStudio.TestTools.WebTesting.Rules
Assembly: Microsoft.VisualStudio.QualityTools.WebTestFramework (in Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)
Syntax
'Declaration
Public Property MatchAttributeName As String
'Usage
Dim instance As ValidationRuleRequiredAttributeValue
Dim value As String
value = instance.MatchAttributeName
instance.MatchAttributeName = value
public string MatchAttributeName { get; set; }
public:
property String^ MatchAttributeName {
String^ get ();
void set (String^ value);
}
public function get MatchAttributeName () : String
public function set MatchAttributeName (value : String)
Property Value
Type: System.String
An attribute name.
Remarks
This property, in conjunction with MatchAttributeValue, provides additional information for specifying the attribute to validate.
Consider the following HTML:
<input name="Name" type="text" id="TextBox1" size="25" />
<input name="Email" type="text" id="TextBox2" size="25" />
<input name="Password" type="password" id="TextBox3" size="25" />
You would like to validate that there is an input box for the user to enter a password, and for security, that the type of the input is password.
Note
A text input displays letters while the user types; a password input displays * while the user types.
In order to do this, set the TagName property to input, the AttributeName property to type, and the ExpectedValue property to password.
Notice that all three tags in the HTML are input tags, and contain a type attribute. To validate the attribute in the correct tag, you must provide additional information. Set the MatchAttributeName property to name, and the MatchAttributeValue property to Password. Now there is only one tag that satisfies the specified criteria, and the attribute validation rule will be applied to that tag.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
ValidationRuleRequiredAttributeValue Class