HTML::O...t::Form(3)

πŸ“¦ version 0.6.0, in alpine 3.24

πŸ’– NAME

okay so bestie, this is the HTML::O...t::Form(3) page for HTML::Object::DOM::Element::Form β€” the HTML Object DOM Form Class. It's a User Contributed Perl Documentation page, and it's giving very main-character form-element energy. 🫢

🎬 SYNOPSIS

this is the whole load-up, no cap:

use HTML::Object::DOM::Element::Form;
my $form = HTML::Object::DOM::Element::Form->new ||
    die( HTML::Object::DOM::Element::Form->error, "\n" );

🌸 VERSION

the version is literally:

v0.2.1

✨ DESCRIPTION

okay so this interface represents a <form> element in the DOM. It lets you access β€” and in some cases modify β€” aspects of the form, plus get at its component elements. That's the vibe check, fr fr. πŸ’…

🧬 INHERITANCE

the way that inheritance chain just keeps going? iconic. 🌈

+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +----------------------------------+
| HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Form |
+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +----------------------------------+

πŸ’… PROPERTIES

Inherits properties from its parent HTML::Object::DOM::Element β€” slay.

πŸŽ€ acceptCharset

It's a string reflecting the value of the form's accept-charset HTML attribute, and it represents the character encoding that the server accepts. ✨

Example:

<form action="/some/where" accept-charset="utf-8">
    <button>Ok</button>
</form>

my $inputs = $doc->forms->[0]->acceptCharset; # utf-8

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/acceptCharset

πŸ¦‹ action

A string reflecting the value of the form's action HTML attribute. It contains the URI of a program that processes the information submitted by the form. 🫢

Example:

var $form = $doc->forms->[0];
$form->action = '/cgi-bin/publish';

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/action

🌸 autocomplete

A string β€” either "on" or "off" β€” reflecting the value of the form's autocomplete HTML attribute. It indicates whether the controls in this form can have their values automatically populated by the browser. ⭐

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/autocomplete

πŸ‘‘ elements

Read-only. bestie, don't even try to assign to it.

A collection object holding all form controls (https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements) belonging to this form element. iykyk.

Example:

<form id="my-form">
    <input type="text" name="username">
    <input type="text" name="full-name">
    <input type="password" name="password">
</form>

my $inputs = $doc->getElementById("my-form")->elements;
my $inputByIndex = $inputs->[0];
my $inputByName = $inputs->username;

Another example:

my $inputs = $doc->getElementById("my-form")->elements;

# Iterate over the form controls
for( my $i = 0; $i < $inputs->length; $i++ )
{
    if( $inputs->[i]->nodeName == "INPUT" && $inputs->[i]->type == "text" )
    {
        # Update text input
        $inputs->[i]->value->toLocaleUpperCase();
    }
}

Another example:

my $inputs = $doc->getElementById("my-form")->elements;

# Iterate over the form controls
for( my $i = 0; $i < $inputs->length; $i++ )
{
    # Disable all form controls
    $inputs->[$i]->setAttribute( "disabled", "" );
}

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements, and StackOverflow question: https://stackoverflow.com/questions/34785743/javascript-about-form-elements

🧚 encoding

A string reflecting the value of the form's enctype HTML attribute. It indicates the type of content that is used to transmit the form to the server. Only specified values can be set. The two properties are synonyms. πŸ’œ

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/encoding

πŸ’« length

Read-only. periodt.

A long reflecting the number of controls in the form. πŸ”₯

Example:

if( $doc->getElementById('form1')->length > 1 )
{
    # more than one form control here
}

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/length

πŸ’… method

A string reflecting the value of the form's method HTML attribute. It indicates the HTTP method used to submit the form. Only specified values can be set. no cap. ✨

Example:

$doc->forms->myform->method = 'post';

my $formElement = $doc->createElement("form"); # Create a form
$doc->body->appendChild( $formElement );
say( $formElement->method ); # 'get'

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/method

πŸŽ€ name

A string reflecting the value of the form's name HTML attribute. It contains the name of the form. πŸ¦‹

Example:

my $string = form->name;
form->name = $string;

my $form1name = $doc->getElementById('form1').name;

if ($form1name != $doc->form->form1) {
    # Browser does not support this form of reference
}

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/name

πŸ›‘οΈ noValidate

A boolean value reflecting the value of the form's novalidate HTML attribute. It indicates whether the form should not be validated. πŸ™ˆ

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/noValidate

🎯 target

A URL reflecting the value of the form's target HTML attribute. It indicates where to display the results received from submitting the form. 🌈

Example:

$myForm->target = $doc->frames->[1]->name;

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/target

πŸ› οΈ METHODS

Inherits methods from its parent HTML::Object::DOM::Element β€” the family tree stays iconic. πŸ’–

βœ… checkValidity

In perl, this always returns true, or whatever value you would have set.

In JavaScript environment, this returns true if the element's child controls are subject to constraint validation and satisfy those constraints. It returns false if some controls do not satisfy their constraints. It fires an event named invalid at any control that does not satisfy its constraints; such controls are considered invalid if the event is not canceled. It is up to the programmer to decide how to respond to false. 😭

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/checkValidity

πŸ“£ reportValidity

In perl, this always returns true, or whatever value you would have set.

In JavaScript environment, this returns true if the element's child controls satisfy their validation constraints. When false is returned, cancelable invalid events are fired for each invalid child and validation problems are reported to the user. 🫢

Example:

$doc->forms->myform->addEventListener( submit => sub
{
    $doc->forms->myform->reportValidity();
}, { capture => 0 });

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reportValidity

πŸš€ requestSubmit

Requests that the form be submitted using the specified submit button object and its corresponding configuration. πŸ’…

Example:

my $myForm = $doc->querySelector( 'form' );
my $submitButton = $myForm->querySelector( '#main-submit' );

if( $myForm->requestSubmit )
{
    if( $submitButton )
    {
        $myForm->requestSubmit( $submitButton );
    }
    else
    {
        $myForm->requestSubmit();
    }
}
else
{
    $myForm->submit();
}

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit

πŸ“¨ submit

This does nothing and returns "undef" under perl environment. πŸ’€

In JavaScript environment, this submits the form to the server. πŸ”₯

Example:

$doc->forms->myform->submit();

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit

πŸ‘‘ AUTHOR

Jacques Deguest β€” jack@deguest.jp β€” chef's kiss. πŸ’‹

πŸ¦‹ SEE ALSO

Copyright(c) 2021 DEGUEST Pte. Ltd.

All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay bestie, that's the whole page πŸ’– β€” it's from perl v5.42.2, dated 2026-02-15, and it's the manual for HTML::O...t::Form(3). mwah, go slay your form handling βœ¨πŸ’…

πŸ“¦ where this page comes from