Jump to content

Is It Possible To Deny Enter The Data, If Time Is Too Late?


Recommended Posts

Hi everyone,

 

I have found several scripts that do not allow to submit the data if the date is too late (or too early).

Is it possible to deny to enter the data, if time is too late?

 

I mean, if the data may be added only before 10 AM, and now is 11 AM, then the data is not added and some error message is displayed?

 

Or more simple script, if the data may be added only before 10 AM, and a user tries to enter "11 AM", then the data is not added and some error message is displayed?

 

Thank you for your time!

 

Link to comment
Share on other sites

Hey Cameron !

 

How are you today ?

 

Here is a script which might help you : 

<script>
var v_name = document.getElementById('InsertRecordFirst_Name');
var v_surname=document.getElementById('InsertRecordLast_Name');
var v_date = document.getElementById('InsertRecordDate_Field');
var v_submitRow = document.getElementById('Submit').parentNode.parentNode;

if(new Date().getHours() >= 10 ){

    alert('     TOO LATE, SORRY  !!       YOU CAN ONLY SUBMIT YOUR DATA TILL 10:00 ')
      v_name.disabled = true;
      v_surname.disabled = true;
      v_date.disabled = true;
      v_submitRow.style.display = 'none';
 
}
</script>

Best , 

 

Aurora

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...