Skip to content

Commit

Permalink
Form style bootstrap5 (#939)
Browse files Browse the repository at this point in the history
* added FormStyleBootstrap5 to form.py

* Revert "added FormStyleBootstrap5 to form.py"

This reverts commit f9c0af9.

* added FormStyleBootstrap5 to form.py
  • Loading branch information
Eddiedigits authored Nov 4, 2024
1 parent e35c2bc commit adc34b6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions py4web/utils/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,30 @@ def __call__(
}
)

FormStyleBootstrap5 = FormStyleFactory()
FormStyleBootstrap5.classes.update(
{
"outer": "mb-3 col-auto", # Replaced 'form-group' with 'mb-3' for margin-bottom
"inner": "",
"label": "form-label", # Explicitly use 'form-label' for labels
"info": "form-text",
"error": "form-text text-danger py4web-validation-error",
"submit": "btn btn-primary",
"input": "form-control",
"input[type=text]": "form-control",
"input[type=date]": "form-control",
"input[type=time]": "form-control",
"input[type=datetime-local]": "form-control",
"input[type=radio]": "form-check-input",
"input[type=checkbox]": "form-check-input",
"input[type=submit]": "btn btn-primary",
"input[type=password]": "form-control",
"input[type=file]": "form-control", # Bootstrap 5 doesn't have a specific 'form-control-file' class
"select": "form-select", # 'form-select' is used in Bootstrap 5 instead of 'form-control' for select elements
"textarea": "form-control",
}
)

# ################################################################
# Form object (replaced SQLFORM)
# ################################################################
Expand Down

0 comments on commit adc34b6

Please sign in to comment.