IHTMLOptionButtonElement

IHTMLOptionButtonElement


This interface specifies a form input control.

IHTMLOptionButtonElement Methods
put_value   get_value   get_type  
put_name   get_name   put_checked  
get_checked   put_defaultChecked   get_defaultChecked  
put_onchange   get_onchange   put_disabled  
get_disabled   put_status   get_status  
put_indeterminate   get_indeterminate   get_form  

IHTMLOptionButtonElement::put_value

HRESULT put_value(
    BSTR v 
);

Sets the default or "selected" value of the given control.

v
String specifying the value. The purpose of the string depends on the type of control, as described in the following table.
Control Type Description
checkbox The "selected" value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
file The value, a file name, typed by the user into the control. Unlike other controls, this value is read-only.
hidden The control submits this value when the form is submitted.
OPTION The "selected" value. The containing list box control submits this value only if the user has selected the option.
password The default value. The control displays this value when it is first created and when the user clicks the reset button.
radio The "selected" value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
reset The button label. If not set, the label defaults to "Reset".
submit The button label. If not set, the label defaults to "Submit".
text The default value. The control displays this value when it is first created and when the user clicks the reset button.

See also get_value

IHTMLOptionButtonElement::get_value

HRESULT get_value(
    BSTR *p 
);

Retrieves the default or "selected" value of the given control.

p
Address of a variable that receives the value. This read-write property can be any valid string. The purpose of the string depends on the type of control, as described in the following table.
Control type Description
checkbox The "selected" value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
file The value, a file name, typed by the user into the control. Unlike other controls, this value is read-only.
hidden The control submits this value when the form is submitted.
OPTION The "selected" value. The containing list box control submits this value only if the user has selected the option.
password The default value. The control displays this value when it is first created and when the user clicks the reset button.
radio The "selected" value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
reset The button label. If not set, the label defaults to "Reset".
submit The button label. If not set, the label defaults to "Submit".
text The default value. The control displays this value when it is first created and when the user clicks the reset button.

See also put_value

IHTMLOptionButtonElement::get_type

HRESULT get_type(
    BSTR *p 
);

Retrieves the type of intrinsic control represented by the given element object.

p
Address of a variable that receives the type. The possible values depend on the element as listed in the following table.

Element Possible value Description
INPUT checkbox Used for simple Boolean attributes or for attributes that can take multiple values at the same time. It is represented by a number of check box fields, each of which has the same name. Each selected check box generates a separate name/value pair in the submitted data, even if this results in duplicate names. The default value for check boxes is on.
file A file upload element.
hidden No field is presented to the user, but the content of the field is sent with the submitted form. This value can be used to transmit state information about client/server interaction.
image An image field that you can click, causing the form to be immediately submitted. The coordinates of the selected point are measured in pixel units from the upper-left corner of the image, and are returned (along with the other contents of the form) in two name/value pairs. The x-coordinate is submitted under the name of the field with .x appended, and the y-coordinate is submitted under the name of the field with .y appended. Any value property is ignored. The image itself is specified by the SRC attribute, exactly as for the Image element.
password Same as the TEXT attribute, except that text is not displayed as the user enters it.
radio Used for attributes that accept a single value from a set of alternatives. Each radio-button field in the group should be given the same name. Only the selected radio button in the group generates a name/value pair in the submitted data. Radio buttons require an explicit value property.
reset reset is a button that when clicked resets the form's fields to their specified initial values. The label to be displayed on the button can be specified just as for the submit button.
submit submit is a button that when clicked submits the form. You can use the value attribute to provide a non-editable label to be displayed on the button. The default label is application-specific. If a submit button is clicked to submit the form, and that button has a name attribute specified, that button contributes a name/value pair to the submitted data. Otherwise, a submit button makes no contribution to the submitted data.
text Used for a single-line text-entry field. Use in conjunction with the size and maxLength properties.
SELECT select-multiple Specifies a multiple-select list box.
select-one Specifies a single-select list box.
TEXTAREA textarea Used for multiple-line text-entry fields. Use in conjunction with the size and maxLength properties.

IHTMLOptionButtonElement::put_name

HRESULT put_name(
    BSTR v 
);

Sets the name of the control, bookmark, or application.

v
String specifying the name.

The name is used to bind the value of the control when submitting a form. The NAME is not the value that is displayed for the button, reset, and submit objects. Submitting the form submits the internally stored value, not the one displayed.

JScript allows the name to be changed at run time. This does not change the name in the programming model, in the collection of elements, but does change the name used for submitting elements.

See also get_name

IHTMLOptionButtonElement::get_name

HRESULT get_name( 
    BSTR *p 
);

Retrieves the name of the control, bookmark, or application.

p
Address of a string variable that receives the name.

The name is used to bind the value of the control when submitting a form. The NAME is not the value that is displayed for the button, reset, and submit objects. Submitting the form submits the internally stored value, not the one displayed.

JScript allows the name to be changed at run time. This does not change the name in the programming model, in the collection of elements, but does change the name used for submitting elements.

See also put_name

IHTMLOptionButtonElement::put_checked

HRESULT put_checked(
    VARIANT_BOOL v 
);

Sets whether the given check box or radio button is selected.

v
Select flag. Set this parameter to TRUE to select the button, or FALSE otherwise.

Check boxes that are not selected do not return their values when the form is submitted.

See also get_checked

IHTMLOptionButtonElement::get_checked

HRESULT get_checked(
    VARIANT_BOOL *p 
);

Retrieves whether the given check box or radio button is selected.

p
Address of a variable that receives TRUE if the button is selected, or FALSE otherwise. The default value for this property is FALSE.

Check boxes that are not selected do not return their values when the form is submitted.

See also put_checked

IHTMLOptionButtonElement::put_defaultChecked

HRESULT put_defaultChecked(
    VARIANT_BOOL v 
);

Determines whether the check box or radio button is selected by default.

v
Selection flag. Set this value to TRUE to select the button, or FALSE otherwise.

This value can be changed programmatically but has no effect on the appearance nor on how forms are submitted.

See also get_defaultChecked

IHTMLOptionButtonElement::get_defaultChecked

HRESULT get_defaultChecked(
    VARIANT_BOOL *p 
);

Determines whether the check box or radio button is selected by default.

p
Address of a variable that receives TRUE if the button is selected by default, or FALSE otherwise.

This value can be changed programmatically but has no effect on the appearance nor on how forms are submitted.

The default value for this property is TRUE.

See also put_defaultChecked

IHTMLOptionButtonElement::put_onchange

HRESULT put_onchange(
    VARIANT v 
);

Sets the inline script associated with the onchange event on the OptionButtonElement. This event occurs when the contents of the object have changed.

v
VARIANT structure that contains the script to be set.

For more information on inline script, see Attaching an Event Handler in the Understanding the Event Model documentation.

See also get_onchange

IHTMLOptionButtonElement::get_onchange

HRESULT get_onchange( 
    VARIANT *p 
);

Retrieves the inline script associated with the onchange event on the OptionButtonElement. This event occurs when the contents of the object have changed.

p
Address of a VARIANT structure that contains the script.

For more information on inline script, see Attaching an Event Handler in the Understanding the Event Model documentation.

See also put_onchange

IHTMLOptionButtonElement::put_disabled

HRESULT put_disabled(
    VARIANT_BOOL v 
);

Enables or disables the control. A disabled control appears dimmed and does not respond to user input.

v
Boolean value specifying whether to disable the control. If TRUE, the control is disabled; otherwise, it is enabled.

The default value for this property is FALSE.

See also get_disabled

IHTMLOptionButtonElement::get_disabled

HRESULT get_disabled(
    VARIANT_BOOL *p 
);

Determines whether the control is enabled or disabled.

p
Address of a variable that receives TRUE if the control is disabled, or FALSE otherwise.

The default value for this property is FALSE.

See also put_disabled

IHTMLOptionButtonElement::put_status

HRESULT put_status(
    VARIANT_BOOL v 
);

Sets the value of a check box or radio button. This property is equivalent to the value property for check boxes and radio buttons.

v
Value specifying the status. It can be either TRUE or FALSE.

See also get_status

IHTMLOptionButtonElement::get_status

HRESULT get_status(
    VARIANT_BOOL *p 
);

Retrieves the value of a check box or radio button. This property is equivalent to the value property for check boxes and radio buttons.

p
Address of a value that receives the status. It can be either TRUE or FALSE.

See also put_status

IHTMLOptionButtonElement::put_indeterminate

HRESULT put_indeterminate(
    VARIANT_BOOL v 
);

Changes the user interface of a check box to have a dimmed background to represent an indeterminate state.

When indeterminate is set, the check box appears checked, but dimmed. The value of indeterminate is independent of the values for the checked and status properties.

v
Indeterminate flag. If TRUE, the check box is indeterminate.

This does not change whether the check box is marked as checked, and is different than disabling the control. A check box in the indeterminate state can still receive the focus. When the user clicks an indeterminate button, the indeterminate state is turned off and the check box is appropriately checked or unchecked.

The default value for this property is FALSE.

See also get_indeterminate

IHTMLOptionButtonElement::get_indeterminate

HRESULT get_indeterminate(
    VARIANT_BOOL *p 
);

Retrieves whether the check box is in the indeterminate state. An indeterminate check box has a dimmed background to represent an indeterminate state.

When indeterminate is set, the check box appears checked, but dimmed. The value of indeterminate is independent of the values for the checked and status properties.

v
Address of a value that receives TRUE if the check box is indeterminate, or FALSE otherwise.

This does not change whether the check box is marked as checked, and is different than disabling the control. A check box in the indeterminate state can still receive the focus. When the user clicks an indeterminate button, the indeterminate state is turned off and the check box is appropriately checked or unchecked.

The default value for this property is FALSE.

See also put_indeterminate

IHTMLOptionButtonElement::get_form

HRESULT get_form(
    IHTMLFormElement **p 
);

Retrieves a reference to the form the element is embedded on.

p
Address of a variable that receives an interface pointer to the form element. This parameter receives NULL if the element is not on a form.

See also IHTMLFormElement

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.