Skip to content

Commit

Permalink
fix: text input widgets issue after set default values
Browse files Browse the repository at this point in the history
  • Loading branch information
raktima-opensignlabs committed Mar 2, 2024
1 parent 4e39762 commit fbcdfa9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ const NameModal = (props) => {
required
/>
</div>
{props.widgetName === "text" && (
{(props.defaultdata?.type === "text" ||
props.widgetName === "text") && (
<>
<div className="form-section">
<label htmlFor="textvalidate" style={{ fontSize: 13 }}>
Expand Down Expand Up @@ -187,7 +188,15 @@ const NameModal = (props) => {
invalid default value
</p>
) : (
<p style={{ color: "transparent", fontSize: 8 }}>.</p>
<p
style={{
color: "transparent",
fontSize: 10,
margin: "3px 8px"
}}
>
.
</p>
)}
</div>
</>
Expand Down Expand Up @@ -234,7 +243,8 @@ const NameModal = (props) => {
})}
</div>
</div>
{props.widgetName === "text" && (
{(props.defaultdata?.type === "text" ||
props?.widgetName === "text") && (
<div className="form-section">
<label htmlFor="hint" style={{ fontSize: 13 }}>
Hint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,6 @@ function Placeholder(props) {
});
setDateFormat(updateDate);
};
useEffect(() => {
//set default current date and default format MM/dd/yyyy
if (props.isPlaceholder || props.isSignYourself) {
const date = new Date();
const milliseconds = date.getTime();
const newDate = moment(milliseconds).format("MM/DD/YYYY");
const dateObj = {
date: newDate,
format: "MM/dd/YYYY"
};
setSelectDate(dateObj);
}
}, []);
useEffect(() => {
if (props.isPlaceholder || props.isSignYourself) {
selectDate && changeDateFormat();
Expand All @@ -101,9 +88,7 @@ function Placeholder(props) {
setIsShowDateFormat(!isShowDateFormat);
}
};

document.addEventListener("click", closeMenuOnOutsideClick);

return () => {
// Cleanup the event listener when the component unmounts
document.removeEventListener("click", closeMenuOnOutsideClick);
Expand Down

0 comments on commit fbcdfa9

Please sign in to comment.