1 38 package com.gargoylesoftware.htmlunit.javascript.host; 39 40 import java.io.IOException ; 41 42 import org.mozilla.javascript.Function; 43 44 import com.gargoylesoftware.htmlunit.html.ClickableElement; 45 import com.gargoylesoftware.htmlunit.html.HtmlElement; 46 47 56 public class FormField extends FocusableHostElement { 57 58 private static final long serialVersionUID = 3712016051364495710L; 59 60 61 66 public String jsxGet_value() { 67 return getHtmlElementOrDie().getAttributeValue( "value" ); 68 } 69 70 71 76 public void jsxSet_value( final String newValue ) { 77 getHtmlElementOrDie().setAttributeValue( "value", newValue ); 78 } 79 80 81 86 public String jsxGet_name() { 87 return getHtmlElementOrDie().getAttributeValue( "name" ); 88 } 89 90 95 public void jsxSet_name( final String newName ) { 96 getHtmlElementOrDie().setAttributeValue( "name", newName ); 97 } 98 99 100 105 public Form jsxGet_form() { 106 return (Form)getScriptableFor(getHtmlElementOrDie().getEnclosingForm()); 107 } 108 109 114 public String jsxGet_type() { 115 return getHtmlElementOrDie().getAttributeValue("type"); 116 } 117 118 122 public void jsxSet_onchange(final Function onchange) { 123 getHtmlElementOrDie().setEventHandler("onchange", onchange); 124 } 125 126 130 public Function jsxGet_onchange() { 131 return getHtmlElementOrDie().getEventHandler("onchange"); 132 } 133 134 138 public void jsxFunction_click() throws IOException { 139 ((ClickableElement) getHtmlElementOrDie()).click(); 140 } 141 142 145 public void jsxFunction_select() { 146 getLog().debug( "Input.jsxFunction_select() not implemented" ); 147 } 148 149 153 public boolean jsxGet_disabled() { 154 return getHtmlElementOrDie().isAttributeDefined("disabled"); 155 } 156 157 158 162 public void jsxSet_disabled( final boolean disabled ) { 163 final HtmlElement element = getHtmlElementOrDie(); 164 if( disabled ) { 165 element.setAttributeValue("disabled", "disabled"); 166 } 167 else { 168 element.removeAttribute("disabled"); 169 } 170 } 171 172 176 public String jsxGet_tabindex() { 177 return getHtmlElementOrDie().getAttributeValue("tabindex"); 178 } 179 } 180 181 | Popular Tags |