form submit

This commit is contained in:
Jorijn van der Graaf 2025-11-10 21:42:00 +01:00
commit 01d5b1548d

View file

@ -28,12 +28,15 @@ HtmlElement* body = new HtmlElement("body", "<div id='container'>"
"</div>"
"<div class='event-section'>"
"<h2>Form Events</h2>"
"<input type='text' id='formInput' placeholder='Type something'>"
"<select id='formSelect'>"
"<option value='option1'>Option 1</option>"
"<option value='option2'>Option 2</option>"
"<option value='option3'>Option 3</option>"
"</select>"
"<form id='formElement'>"
"<input type='text' id='formInput' placeholder='Type something'>"
"<select id='formSelect'>"
"<option value='option1'>Option 1</option>"
"<option value='option2'>Option 2</option>"
"<option value='option3'>Option 3</option>"
"</select>"
"<button type='submit'>Submit Form</button>"
"</form>"
"<div id='formOutput'></div>"
"</div>"
"<div class='event-section'>"
@ -63,6 +66,7 @@ HtmlElement* focusInput = new HtmlElement("focusInput");
HtmlElement* focusOutput = new HtmlElement("focusOutput");
HtmlElement* formInput = new HtmlElement("formInput");
HtmlElement* formSelect = new HtmlElement("formSelect");
HtmlElement* formElement = new HtmlElement("formElement");
HtmlElement* formOutput = new HtmlElement("formOutput");
HtmlElement* windowOutput = new HtmlElement("windowOutput");
HtmlElement* dragSource = new HtmlElement("dragSource");
@ -138,6 +142,11 @@ int main() {
formOutput->SetInnerHTML(std::format("<p><strong>Select Change:</strong> Value='{}'</p>", event.value));
});
// Submit Event
formElement->AddSubmitListener([&]() {
formOutput->SetInnerHTML("<p><strong>Submit:</strong> Form submitted successfully!</p>");
});
// Window Events
// Resize event
body->AddResizeListener([&](ResizeEvent event) {