Aug
23
2008
0

Q. How do I enter the current date or time into a textfield?

A. Use the Time.now method …
Example html:

<html>
   <body>
      <form method="post" action="">
         <textarea name="comments" cols="40" rows="1">
            Enter your comments here...
         </textarea><br>
         <input type="submit" value="Submit" />
      </form>
   </body>
</html>

Example watir:

t=Time.now
@b.text_field(:name,"comments").set(t.strftime("%m/%d/%Y_%H%:M%"))
Written by Sameh Abdelhamid in: watir | Tags: , ,

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes