Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanalvizo committed Jul 13, 2024
1 parent 0cd929a commit 93718c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions plugins/ui/src/deephaven/ui/components/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ def form(
is_disabled: bool | None = None,
is_required: bool | None = None,
is_read_only: bool | None = None,
validation_state: ValidationState | None = "valid",
validation_state: ValidationState | None = None,
validation_behavior: ValidationBehavior | None = "aria",
# validation_errors # omitted because synchronous return
action: str | None = None,
# TODO dig into why action prop is not working anymore #625
# action: str | None = None,
enc_type: EncodingType | None = None,
method: HTTPMethods | None = None,
target: Target | None = None,
Expand Down Expand Up @@ -101,7 +102,6 @@ def form(
is_read_only: Whether the form should be read only.
validation_state: Whether the Form elements should display their "valid" or "invalid" visual styling.
validation_behavior: Whether to use native HTML form validation to prevent form submission when a field value is missing or invalid, or mark fields as required or invalid via ARIA.
action: The URL to submit the form data to.
enc_type: The enctype attribute specifies how the form-data should be encoded when submitting it to the server.
method: The HTTP method of the form.
target: The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
Expand Down Expand Up @@ -168,7 +168,6 @@ def form(
is_read_only=is_read_only,
validation_state=validation_state,
validation_behavior=validation_behavior,
action=action,
enc_type=enc_type,
method=method,
target=target,
Expand Down
6 changes: 4 additions & 2 deletions plugins/ui/src/js/src/elements/hooks/useFormEventCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export type SerializedFormEventCallback = (event: SerializedFormEvent) => void;

export function useFormEventCallback(
callback?: SerializedFormEventCallback
): (e: React.FormEvent<HTMLFormElement>) => void {
return useCallback(
): ((e: React.FormEvent<HTMLFormElement>) => void) | undefined {
const formCallback = useCallback(
(e: React.FormEvent<HTMLFormElement>) => {
// We never want the page to refresh, prevent submitting the form
e.preventDefault();
Expand All @@ -20,4 +20,6 @@ export function useFormEventCallback(
},
[callback]
);

return callback ? formCallback : undefined;
}

0 comments on commit 93718c8

Please sign in to comment.