Bug 42662: Values of disabled form elements should not be submitted; r=kmcclusk

git-svn-id: svn://10.0.0.236/trunk@75557 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pollmann%netscape.com
2000-08-03 23:32:02 +00:00
parent 2b0d3efc1d
commit 7db58c7c36
17 changed files with 95 additions and 17 deletions

View File

@@ -1399,3 +1399,21 @@ nsFormControlHelper::GetLocalizedString(char* aKey, nsString& oVal)
return rv;
}
// Return value of disabled attribute or PR_FALSE if none set
nsresult
nsFormControlHelper::GetDisabled(nsIContent* aContent, PRBool* oIsDisabled)
{
nsCOMPtr<nsIHTMLContent> formControl = do_QueryInterface(aContent);
nsHTMLValue value;
nsresult result = formControl->GetHTMLAttribute(nsHTMLAtoms::disabled, value);
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
if (eHTMLUnit_Empty == value.GetUnit()) {
*oIsDisabled = PR_TRUE;
} else {
*oIsDisabled = PR_FALSE;
}
} else {
*oIsDisabled = PR_FALSE;
}
return NS_OK;
}