private static object ValidateSelectInput(DOMElementCollection optionElements) { for (int i = 0; i < optionElements.Length; i++) { DOMElement element = optionElements[i]; if ((bool)Type.GetField(element, "selected")) { if (!ValidationUtil.StringIsNullOrEmpty((string)Type.GetField(element, "value"))) { return true; // at least one is selected, so OK } } } return false; // failure }
private static object ValidateSelectInput(DOMElementCollection optionElements) { for (int i = 0; i < optionElements.Length; i++) { DOMElement element = optionElements[i]; if ((bool)Type.GetField(element, "selected")) { if (!ValidationUtil.StringIsNullOrEmpty((string)Type.GetField(element, "value"))) { return(true); // at least one is selected, so OK } } } return(false); // failure }
private static DOMElement[] GetFormElementsWithName(FormElement formElement, string name) { ArrayList allElementsWithNameInForm = new ArrayList(); DOMElementCollection allElementsWithName = Document.GetElementsByName(name); for (int i = 0; i < allElementsWithName.Length; i++) { DOMElement thisElement = allElementsWithName[i]; if (IsElementInHierarchy(formElement, thisElement)) { ArrayList.Add(allElementsWithNameInForm, thisElement); } } return((DOMElement[])allElementsWithNameInForm); }
public FormContext(FormElement formElement, DOMElement validationSummaryElement) { FormElement = formElement; _validationSummaryElement = validationSummaryElement; Type.SetField(formElement, _formValidationTag, this); // need to retrieve the actual <ul> element, since that will be dynamically modified if (validationSummaryElement != null) { DOMElementCollection ulElements = validationSummaryElement.GetElementsByTagName("ul"); if (ulElements.Length > 0) { _validationSummaryULElement = ulElements[0]; } } _onClickHandler = Form_OnClick; _onSubmitHandler = Form_OnSubmit; }