You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overall liking FastHTML and making progress on some tools.
Sample Code below illustrates this - by outputting a SELECT form both ways and showing the results is posted below:
If you're reporting a bug, please continue with this template.
Describe the bug
I find that using select (I think other form elements as well), some legal HTML values for Value are not generated, resulting in odd behavior on the generated page.
Within a form and an empty string as a VALUE, the output OPTION does not generate with a value field. The response value on the form becomes the payload text.
Minimal Reproducible Example
@app.route("/test")defget():
manual_form=NotStr("""<FORM METHOD="POST" ACTION="/test/manual_form"> <SELECT NAME="test_select_field"> <OPTION VALUE="">Option 0</OPTION> <OPTION VALUE="1">Option 1</OPTION> <OPTION VALUE="2">Option 2</OPTION> </SELECT> <INPUT TYPE="submit" VALUE="Submit"> </FORM> """)
returnDiv(P(f"Test route with parameter"),
P("Select Form Generated by FastHTML",
Form(Select(Option("Option 0", value=""), Option("Option 1", value="1"), Option("Option 2", value="2"), NAME="test_select_field"),
Input(type="submit", value=f"Submit"),
Method="POST", Action=f"/test/fasthtml_form",)),
P("Select Form from Raw HTML", manual_form),
)
@app.route("/test/{parameter}")defpost(post_args: dict, parameter: str):
print(f"fastcrud_test_post with parameter {parameter}")
print(f"Result of test_select_field is |{post_args['test_select_field']}|")
returnP(f"Test result - POSTED - parameter {parameter}"), P(f"returned value for test_select_field |{post_args['test_select_field']}|", )
Expected behavior
A clear and concise description of what you expected to happen.
The empty values should be emitted as VALUE=v in the generated HTML so they are properly reflected in HTML actions.
Environment Information
Please provide the following version information:
Screenshots
If applicable, add screenshots to help explain your problem.
Console response from fasthtml select form:
fastcrud_test_post with parameter fasthtml_form
Result of test_select_field is |Option 0|
Console response from raw html select form
fastcrud_test_post with parameter manual_form
Result of test_select_field is ||
The text was updated successfully, but these errors were encountered:
Overall liking FastHTML and making progress on some tools.
Sample Code below illustrates this - by outputting a SELECT form both ways and showing the results is posted below:
If you're reporting a bug, please continue with this template.
Describe the bug
I find that using select (I think other form elements as well), some legal HTML values for Value are not generated, resulting in odd behavior on the generated page.
Within a form and an empty string as a VALUE, the output OPTION does not generate with a value field. The response value on the form becomes the payload text.
Minimal Reproducible Example
Expected behavior
A clear and concise description of what you expected to happen.
The empty values should be emitted as VALUE=v in the generated HTML so they are properly reflected in HTML actions.
Environment Information
Please provide the following version information:
Confirmation
Please confirm the following:
Additional context
| -- | -- | | | <title>FastHTML page</title> | | | <script src="https://unpkg.com/htmx.org@next/dist/htmx.min.js"></script><script src="https://cdn.jsdelivr.net/gh/answerdotai/[email protected]/fasthtml.js"></script><script src="https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js"></script><script src="https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js"></script> | <style>:root { --pico-font-size: 100%; }</style> | <style>:root { --pico-font-size: 65%; }</style> | | | |Add any other context about the problem here.
Generated HTML from the /test example provided:
Test route with parameter
|| Select Form Generated by FastHTML
Option 0Option 1Option 2 | || Select Form from Raw HTML
| | Option 0 | Option 1 | Option 2 | | | | |Screenshots
If applicable, add screenshots to help explain your problem.
Console response from fasthtml select form:
fastcrud_test_post with parameter fasthtml_form
Result of test_select_field is |Option 0|
Console response from raw html select form
fastcrud_test_post with parameter manual_form
Result of test_select_field is ||
The text was updated successfully, but these errors were encountered: