39 dom_string *ds_action = NULL;
40 dom_string *ds_charset = NULL;
41 dom_string *ds_target = NULL;
42 dom_string *ds_method = NULL;
43 dom_string *ds_enctype = NULL;
46 dom_html_form_element *formele = (dom_html_form_element *)(
node);
47 struct form * ret = NULL;
50 if (dom_html_form_element_get_action(formele,
51 &ds_action) != DOM_NO_ERR)
54 if (dom_html_form_element_get_accept_charset(formele,
55 &ds_charset) != DOM_NO_ERR)
58 if (dom_html_form_element_get_target(formele,
59 &ds_target) != DOM_NO_ERR)
62 if (dom_html_form_element_get_method(formele,
63 &ds_method) != DOM_NO_ERR)
66 if (dom_html_form_element_get_enctype(formele,
67 &ds_enctype) != DOM_NO_ERR)
74 if (ds_action != NULL)
76 dom_string_byte_length(ds_action));
78 if (ds_charset != NULL)
79 charset =
strndup(dom_string_data(ds_charset),
80 dom_string_byte_length(ds_charset));
82 if (ds_target != NULL)
84 dom_string_byte_length(ds_target));
88 if (ds_method != NULL) {
89 if (dom_string_caseless_lwc_isequal(ds_method,
90 corestring_lwc_post)) {
92 if (ds_enctype != NULL) {
93 if (dom_string_caseless_lwc_isequal(ds_enctype,
94 corestring_lwc_multipart_form_data)) {
106 if (ds_action != NULL)
107 dom_string_unref(ds_action);
108 if (ds_charset != NULL)
109 dom_string_unref(ds_charset);
110 if (ds_target != NULL)
111 dom_string_unref(ds_target);
112 if (ds_method != NULL)
113 dom_string_unref(ds_method);
114 if (ds_enctype != NULL)
115 dom_string_unref(ds_enctype);
128 dom_html_collection *forms;
129 struct form *ret = NULL, *newf;
138 if (dom_html_document_get_forms(doc, &forms) != DOM_NO_ERR)
142 if (dom_html_collection_get_length(forms, &nforms) != DOM_NO_ERR)
146 for (n = 0; n < nforms; ++n) {
147 if (dom_html_collection_item(forms, n, &
node) != DOM_NO_ERR) {
151 dom_node_unref(
node);
162 while (ret != NULL) {
170 dom_html_collection_unref(forms);
178 while (forms != NULL) {
192 dom_html_form_element *
form = NULL;
193 dom_string *ds_type = NULL;
194 dom_string *ds_value = NULL;
195 dom_string *ds_name = NULL;
197 err = dom_html_button_element_get_form(button, &
form);
198 if (err != DOM_NO_ERR)
201 err = dom_html_button_element_get_type(button, &ds_type);
202 if (err != DOM_NO_ERR)
205 if (ds_type == NULL) {
208 if (dom_string_caseless_lwc_isequal(ds_type,
209 corestring_lwc_submit)) {
211 }
else if (dom_string_caseless_lwc_isequal(ds_type,
212 corestring_lwc_reset)) {
222 err = dom_html_button_element_get_value(button, &ds_value);
223 if (err != DOM_NO_ERR)
225 err = dom_html_button_element_get_name(button, &ds_name);
226 if (err != DOM_NO_ERR)
229 if (ds_value != NULL) {
231 dom_string_data(ds_value),
232 dom_string_byte_length(ds_value));
234 if (control->
value == NULL) {
241 if (ds_name != NULL) {
243 dom_string_data(ds_name),
244 dom_string_byte_length(ds_name));
246 if (control->
name == NULL) {
253 if (
form != NULL && control != NULL)
258 dom_node_unref(
form);
260 dom_string_unref(ds_type);
261 if (ds_value != NULL)
262 dom_string_unref(ds_value);
264 dom_string_unref(ds_name);
273 dom_html_form_element *
form = NULL;
274 dom_string *ds_type = NULL;
275 dom_string *ds_name = NULL;
276 dom_string *ds_value = NULL;
280 if (dom_html_input_element_get_form(input, &
form) != DOM_NO_ERR)
283 if (dom_html_input_element_get_type(input, &ds_type) != DOM_NO_ERR)
286 if (dom_html_input_element_get_name(input, &ds_name) != DOM_NO_ERR)
291 dom_string_byte_length(ds_name));
293 if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
294 corestring_lwc_password)) {
296 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
297 corestring_lwc_file)) {
299 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
300 corestring_lwc_hidden)) {
302 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
303 corestring_lwc_checkbox)) {
305 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
306 corestring_lwc_radio)) {
308 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
309 corestring_lwc_submit)) {
311 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
312 corestring_lwc_reset)) {
314 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
315 corestring_lwc_button)) {
317 }
else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type,
318 corestring_lwc_image)) {
335 if (dom_html_input_element_get_checked(
344 if (dom_html_input_element_get_max_length(
362 if (dom_html_input_element_get_value(
363 input, &ds_value) == DOM_NO_ERR) {
364 if (ds_value != NULL) {
366 dom_string_data(ds_value),
367 dom_string_byte_length(ds_value));
368 if (control->
value == NULL) {
379 if (control->
value == NULL) {
380 control->
value = strdup(
"");
381 if (control->
value == NULL) {
404 control->
node_value = dom_string_ref(ds_value);
410 if (
form != NULL && control != NULL)
415 dom_node_unref(
form);
417 dom_string_unref(ds_type);
419 dom_string_unref(ds_name);
420 if (ds_value != NULL)
421 dom_string_unref(ds_value);
433 dom_html_form_element *
form = NULL;
434 dom_string *ds_name = NULL;
438 if (dom_html_text_area_element_get_form(
ta, &
form) != DOM_NO_ERR)
441 if (dom_html_text_area_element_get_name(
ta, &ds_name) != DOM_NO_ERR)
446 dom_string_byte_length(ds_name));
459 if (
form != NULL && control != NULL)
464 dom_node_unref(
form);
466 dom_string_unref(ds_name);
479 dom_html_form_element *
form = NULL;
480 dom_string *ds_name = NULL;
484 if (dom_html_select_element_get_form(
select, &
form) != DOM_NO_ERR)
487 if (dom_html_select_element_get_name(
select, &ds_name) != DOM_NO_ERR)
492 dom_string_byte_length(ds_name));
505 dom_html_select_element_get_multiple(
select,
506 &(control->
data.select.multiple));
508 if (
form != NULL && control != NULL)
513 dom_node_unref(
form);
515 dom_string_unref(ds_name);
530 ctl->
value = strdup(
"");
532 ctl->
name = strdup(
"foo");
550 dom_string *ds_name = NULL;
553 for (f = forms; f != NULL; f = f->
prev) {
561 err = dom_element_get_tag_name(
node, &ds_name);
562 if (err == DOM_NO_ERR && ds_name != NULL) {
565 if (dom_string_caseless_lwc_isequal(ds_name,
566 corestring_lwc_button)) {
568 (dom_html_button_element *)
node);
569 }
else if (dom_string_caseless_lwc_isequal(ds_name,
570 corestring_lwc_input)) {
572 (dom_html_input_element *)
node);
573 }
else if (dom_string_caseless_lwc_isequal(ds_name,
574 corestring_lwc_textarea)) {
576 (dom_html_text_area_element *)
node);
577 }
else if (dom_string_caseless_lwc_isequal(ds_name,
578 corestring_lwc_select)) {
580 (dom_html_select_element *)
node);
589 dom_string_unref(ds_name);
char * strndup(const char *s, size_t n)
Duplicate up to n characters of a string.
Useful interned string pointers (interface).
Private data for text/html content.
Interface to utility string handling.