Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle invalid input in TimeFieldMinMax, resolve missing CSS reference, and remove classnames #110

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.webforj.samples.views.fields.timefield;

import com.webforj.App;
import com.webforj.annotation.InlineStyleSheet;
import com.webforj.component.Composite;
import com.webforj.component.button.Button;
import com.webforj.component.button.ButtonTheme;
Expand All @@ -14,7 +13,6 @@

import java.time.LocalTime;

@InlineStyleSheet("context://css/fields/timefield/timeFieldMinMaxView.css")
@Route
@FrameTitle("Time Field Min/Max")
public class TimeFieldMinMaxView extends Composite<FlexLayout> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do something useful with the confirm button. A toast ?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented a toast to confirm the action

Expand All @@ -38,14 +36,15 @@ public TimeFieldMinMaxView() {
.setMax(max);

meeting.setLabel(label)
.onModify(e -> {
try {
meeting.setText(e.getText());
confirm.setEnabled(true);
} catch (IllegalArgumentException ex) {
confirm.setEnabled(false);
}
App.console().log(meeting.getValue() + "");
});
.onModify(e -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use onValueChange and the get the value from the event's payload

try {
LocalTime parsedTime = LocalTime.parse(e.getText());
meeting.setValue(parsedTime);
confirm.setEnabled(true);
} catch (Exception ex) {
confirm.setEnabled(false);
App.console().log("Invalid time input: " + e.getText());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no browser console logs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class TimeFieldView extends Composite<FlexLayout> {
public TimeFieldView() {
getBoundComponent().setMargin("var(--dwc-space-m)");

reminder.addClassName("date__input");

getBoundComponent().add(reminder);
}

Expand Down