OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

stop const fomr checking (required text field) on initial load

  • Thread starter Thread starter Hadrian Clayton
  • Start date Start date
H

Hadrian Clayton

Guest
I have a constant and I simply just want to stop it from checking a required text field that it is targeting only on page load to stop the error message from appearing at first:

Code:
const fromSchema = computed(() => {
   return props.required
     ? yup.mixed().required(t('this text field is required', [props.fromDateName]))    
     : yup.mixed().notRequired()
})

my main concern is with the .required() it checks the textfield it is in when I load the page where this const is being used.

what I tried:

  • onMount()
  • onClick()

this is also a date check (calendar date picker)

what should I modify with yup.mixed().required(t('message.error.ECM119', [props.fromDateName])) to stop my issue from happening?

<p>I have a constant and I simply just want to stop it from checking a required text field that it is targeting only on page load to stop the error message from appearing at first:</p>
<pre><code>const fromSchema = computed(() => {
return props.required
? yup.mixed().required(t('this text field is required', [props.fromDateName]))
: yup.mixed().notRequired()
})
</code></pre>
<p>my main concern is with the <code>.required()</code> it checks the textfield it is in when I load the page where this const is being used.</p>
<p>what I tried:</p>
<ul>
<li>onMount()</li>
<li>onClick()</li>
</ul>
<p>this is also a date check (calendar date picker)</p>
<p>what should I modify with <code>yup.mixed().required(t('message.error.ECM119', [props.fromDateName]))</code> to stop my issue from happening?</p>
 

Latest posts

Top