derrick katungi Posted August 25, 2011 Share Posted August 25, 2011 i want to create a form with textfields that take any time i.e. 7:30 or 6:00 as input and store them in a variable. help... thanks Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 25, 2011 Share Posted August 25, 2011 So what's your question? Quote Link to comment Share on other sites More sharing options...
etnastyles Posted August 25, 2011 Share Posted August 25, 2011 yeah this seems easy enough - this will just be a normal text field which you can use jquery and masked input to create the rule of [0-9]:[0-9] which is cool and if i was you for the database type i would set it as a varchar this would except numbers and characters too.. hope this helpsss Quote Link to comment Share on other sites More sharing options...
chronister Posted August 25, 2011 Share Posted August 25, 2011 Yeah, it appears to be just normal form field processing. You can use the whole mask thing, but I find it annoying when the page dictates what can be entered via javascript. I would just make it so you can accept any time format and then make it the format you want. if i was you for the database type i would set it as a varchar this would except numbers and characters too. I disagree with this. At first it makes it easy as the rules are not so tight as to how it is formatted... but if you need to do any kind of query past SELECT this FROM that you may have trouble. When I started, I would store dates and times in a varchar field and it made it easy, until I needed to select dates and times between 2 points, or dates where it falls on a particular day.. Store dates and time as the proper format, it will become easier as time goes. Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 25, 2011 Share Posted August 25, 2011 Store dates and time as the proper format, it will become easier as time goes. I totally agree! Start to do the *proper* thing now and it will save you a lot of pain in the future. Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted August 26, 2011 Author Share Posted August 26, 2011 if this <input type="text" name="textfield" id="textfield" /> were my textfield, how would i format it so as to capture only time from the user? Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 26, 2011 Share Posted August 26, 2011 You need JavaScript to capture the user time (PC Time) and use AJAX to send the time to server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.