Add textarea support back in.

This commit is contained in:
Michael Drake 2012-07-21 18:16:04 +01:00
parent 9d3986e768
commit 792dbe6e44

View File

@ -391,6 +391,52 @@ out:
return control;
}
static struct form_control *
parse_textarea_element(struct form *forms, dom_html_text_area_element *ta)
{
struct form_control *control = NULL;
dom_html_form_element *form = NULL;
dom_string *ds_name = NULL;
char *name = NULL;
if (dom_html_text_area_element_get_form(ta, &form) != DOM_NO_ERR)
goto out;
if (dom_html_text_area_element_get_name(ta, &ds_name) != DOM_NO_ERR)
goto out;
if (ds_name != NULL)
name = strndup(dom_string_data(ds_name),
dom_string_byte_length(ds_name));
control = form_new_control(ta, GADGET_TEXTAREA);
if (control == NULL)
goto out;
if (name != NULL) {
/* Hand the name string over */
control->name = name;
name = NULL;
}
if (form != NULL && control != NULL)
form_add_control(find_form(forms, form), control);
out:
if (form != NULL)
dom_node_unref(form);
if (ds_name != NULL)
dom_string_unref(ds_name);
if (name != NULL)
free(name);
return control;
}
static struct form_control *
invent_fake_gadget(dom_node *node)
{
@ -441,6 +487,10 @@ struct form_control *html_forms_get_control_for_node(struct form *forms, dom_nod
html_dom_string_input)) {
ctl = parse_input_element(forms,
(dom_html_input_element *) node);
} else if (dom_string_caseless_isequal(ds_name,
html_dom_string_textarea)) {
ctl = parse_textarea_element(forms,
(dom_html_text_area_element *) node);
}
}