Re: [flexcoders] Re: Time Validating
On Friday 06 October 2006 20:32, qnotemedia wrote: Thanks Tom - very nice stuff. Just goes to show that there's so many different ways to do the same darn thing. I really need to learn Reg Exp's! If you need to extract bits from a sting that has a patten to it, they are often much faster than 'normal' string functions - esp. if the pattern is fairly complex. -- Tom Chiverton Helping to interactively target leading-edge solutions This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Re: Time Validating
On Thursday 05 October 2006 18:40, boy_trike wrote: just to share, here is what I came up with called from the change event: In the same spirit, here's an untested regexp: /(\d){1,2}:(\d){0,2}/ You get hours in result[0] and if result.length 1 you have minutes in result[1]. Much easier. While we're on the subject, if anyone needs to parse String to Date, pay attention to thefalken.livejournal.com over the weekend (friend me to get a sneak preview :-) )ยท -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Time Validating
Thanks Tom - very nice stuff. Just goes to show that there's so many different ways to do the same darn thing. I really need to learn Reg Exp's! - Chris --- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: In the same spirit, here's an untested regexp: /(\d){1,2}:(\d){0,2}/ You get hours in result[0] and if result.length 1 you have minutes in result[1]. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Re: Time Validating
On Wednesday 04 October 2006 20:28, qnotemedia wrote: if ((setTime.length == 4 setTime.charAt(1) == : int (setTime.charAt(0)) = 1 int(setTime.charAt(0)) = 9 int (setTime.charAt(2)) = 5 int(setTime.charAt(3)) = 9) Is there any reason to use a million and one charAt checks rather than a couple of regular expressions ? -- Tom Chiverton Helping to challengingly transition bleeding-edge data This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Time Validating
just to share, here is what I came up with called from the change event: I am also restricting the input to numbers, :, AM, PM private function processTime( event : Event ) : void { var cbtLength : int = this.text.length; // IF FIRST DIGIT IS 1 ASSUME THEY FORGOT THE LEADING ZERO if (cbtLength == 1 this.text.charAt(0) '1') { this.text = 0 + this.text + ':'; this.setSelection(4,4) ; } if (cbtLength == 2) { // 2 CHARACTERS ENTERED, IF LAST ONE IS : ADD LEADING ZERO if (this.text.charAt(1) == :) { this.text = 0 + this.text ; this.setSelection(4,4) ; } else { this.text += : ; // ELSE ADD COLON TO END this.setSelection(4,4) ; } } if (cbtLength == 5) { // AFTER 5 CHARACTERS ENTERED ADD THE AM OR PM if (this.text.substr(0,2) 06 this.text.substr(0,2) 12) this.text += ' AM' else this.text += ' PM' ; } } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Time Validating
Having the same problem here. IMHO, this is so much easier in CF7 Flash Forms with the mask property (mask=99:99 always forces four numbers with a colon in the middle), and I'm not sure why it has to be as complicated as it is in Flex2. The closest I've gotten is by using a number validator and changing the decimalSeparator property to colon. Unfortunately, this will still allow times like 1:234, 123:4, 1234, etc. I'm assuming though you can probably develop something with RegExp, but I don't quite understand enough about regular expressions. Another interesting thing...I noticed that DateChooser's selectedDate property includes time as part of its data. Any way to format or access that? Agreed though - surely someone has taken care of this. - Chris --- In flexcoders@yahoogroups.com, boy_trike [EMAIL PROTECTED] wrote: Flex has a NUMBERformatter and a DATEFormatter. I have the need for a time formatter and would not like to re-invent what someone else must have already done. Ideally I want to have a textinput field which restricts input to 0-9: APM. I would like to accept the following and convert all to 3PM 3P 3 3:00 03:00 15:00 3:00PM Of course, if the time is invalid (i.e. 2:65PM, 25:2, etc.) I would like to display an error Does something like this exist or must I roll my own? thanks: Bruce -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Time Validating
Well - just spent some time with this. Here's what I came up with. Sloppy, but it works. This allows standard times (1:00, 12:00, 12:59), but not military time (24:00, 13:59, etc.). private function validateTime():void { var setTime:String = new String; setTime = timeToAdd.text; if ((setTime.length == 4 setTime.charAt(1) == : int (setTime.charAt(0)) = 1 int(setTime.charAt(0)) = 9 int (setTime.charAt(2)) = 5 int(setTime.charAt(3)) = 9) || (setTime.length == 5 setTime.charAt(2) == : int (setTime.charAt(0)) == 1 int(setTime.charAt(1)) = 2 int (setTime.charAt(3)) = 5 int(setTime.charAt(4)) = 9)) { Alert.show(Valid Number); } else { Alert.show (Plesae enter a correct time (i.e. 12:00, 9:00, etc.); } } mx:HBox mx:Label text=Type in a Time:/ mx:TextInput id=timeToAdd width=100% text=12:00 / /mx:HBox --- In flexcoders@yahoogroups.com, qnotemedia [EMAIL PROTECTED] wrote: Having the same problem here. IMHO, this is so much easier in CF7 Flash Forms with the mask property (mask=99:99 always forces four numbers with a colon in the middle), and I'm not sure why it has to be as complicated as it is in Flex2. The closest I've gotten is by using a number validator and changing the decimalSeparator property to colon. Unfortunately, this will still allow times like 1:234, 123:4, 1234, etc. I'm assuming though you can probably develop something with RegExp, but I don't quite understand enough about regular expressions. Another interesting thing...I noticed that DateChooser's selectedDate property includes time as part of its data. Any way to format or access that? Agreed though - surely someone has taken care of this. - Chris --- In flexcoders@yahoogroups.com, boy_trike boy_trike@ wrote: Flex has a NUMBERformatter and a DATEFormatter. I have the need for a time formatter and would not like to re-invent what someone else must have already done. Ideally I want to have a textinput field which restricts input to 0-9: APM. I would like to accept the following and convert all to 3PM 3P 3 3:00 03:00 15:00 3:00PM Of course, if the time is invalid (i.e. 2:65PM, 25:2, etc.) I would like to display an error Does something like this exist or must I roll my own? thanks: Bruce -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/