0

I have a form in which I have Field named 'Start Time' and 'Stop time'.Data in start time field is entered by user and stop field is in disabled mode initially. I want to enable the stop field after the 3 hrs of the entered value in start time. is it possible by java script/php/html.Which is the best way to achieve it.My java code is

function timedOut() {
    alert("First Process Completed");
}

// set a timer
setTimeout( timedOut , 600000 );

I am calling this java function on the click on the submit button.Can i do it automatically after one hour of enterd value in start filed.

  • 2
    Welcome to Stack Overflow! Please take the [tour] (you get a badge!) and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) Your best bet here is to do your research, [search](/help/searching) for related topics on SO, and give it a go. ***If*** you get stuck and can't get unstuck after doing more research and searching, post a [mcve] of your attempt and say specifically where you're stuck. People will be glad to help. – T.J. Crowder Nov 11 '19 at 09:09
  • 1
    If you tried something and difficult in getting solution, post your code here with the error you got. – Oops Nov 11 '19 at 09:09
  • @mplungjan i have updated my efforts –  Nov 11 '19 at 09:41
  • JAVA is not the same as JavScript. Please have a look around first. Your attempt is not very useful. You need something like `function timedOut() { document.getElementById("stopField").disabled=false; } setTimeout( timedOut , new Date(document.getElementById("startfield").value()).getTime() - new Date().getTime() +(3*60*60*1000))` – mplungjan Nov 11 '19 at 09:46

1 Answers1

-1

Use Javascript/sessionStorage or javascript/localStorage on client side. If u you need to record the time on the server then send the start-time to php

Nic
  • 597
  • 1
  • 4
  • 17