aknudsen Posted September 1, 2006 Share Posted September 1, 2006 I have a field for URL and would like to have HTTP:// put in the beginning of the field. Is there a way to run a script when you leave a field or do I have to pre populate it? The reason is that if I send a record via email not all email clients use the link if HTTP:// is missing. Also is there a way to format a field i.e ###-###-#### for phone numbers and my last question is, how can you restrict the field to a limited set of characters? I used to develop in Clarion which has all the field level control you can wish for. Filemaker seems flexible, but is a lot more limited than what I'm used to. Why I switched? I'm on a Mac these days. Quote Link to comment Share on other sites More sharing options...
aknudsen Posted September 1, 2006 Author Share Posted September 1, 2006 I'm on 8.5 Advanced Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted September 1, 2006 Share Posted September 1, 2006 Calc text field. Put it on top of the plain text field; the calc field should be formatted to not allow cursor input in Browse Mode. Case(left(TableName::URLfield, 4)≠"http", "http://") & TableName::URLField When it comes time to sending a record via email, always utilize the calc field, not the original data input field. Quote Link to comment Share on other sites More sharing options...
aknudsen Posted September 1, 2006 Author Share Posted September 1, 2006 Thanks, my issue was where do you add that, which I found. Still fumbling around here since it is so different from what I'm used to. Clarion also uses a lot of case structures. Maybe if won't take me that long Quote Link to comment Share on other sites More sharing options...
CobaltSky Posted September 1, 2006 Share Posted September 1, 2006 I have a field for URL and would like to have HTTP:// put in the beginning of the field. Is there a way to run a script when you leave a field or do I have to pre populate it? The reason is that if I send a record via email not all email clients use the link if HTTP:// is missing. Hello aknudsen, The technique described by AHunter3 is the kind of thing that used to be necessary prior to the release of FileMaker 7. However since you are using v8.5 Advanced, there is a different approach that you may find preferable. Rather than creating an additional calc field and stacking it on top of the data entry field on each layout where the URL field appears, simply define an auto-enter calc (same formula will do) and disable the "Do not replace existing value of field (if any)..." option. The original data as entered, will then automatically update to add the http:// (if required) as the user leaves the field. Also is there a way to format a field i.e ###-###-#### for phone numbers and my last question is, how can you restrict the field to a limited set of characters? Yes. Rather than providing built-in pre-formatting masks, FileMaker provides the mechanism within which you can build your own masks/filters - which, when you understand it, can be rather more powerful and flexible than most of the 'canned' options. The way it works is rather like the method I described for conditionally adding a prefix to your URLs by defining an auto-enter/replace-contents formula to the original field. You can do the same thing using a formula that will apply a format (such as the phone format you've mentioned) and/or filter the characters in the field - and because *you* write the formula, the process is open ended. As it happens, you will find a description of a phone number formattting procedure in the TechInfo knowledge base on the FileMaker site. You should be readily able to adapt the method they describe, so I won't include a detailed description or formula at this stage. (Let us know if you encounter problems getting it set up to work the way you require). The relevant knowledge base article is at at: http://filemaker.custhelp.com/cgi-bin/filemaker.cfg/php/enduser/std_adp.php?p_faqid=5247 As regards character filtering, I suggest you use FileMaker's native Filter( ) function, (again as an auto-enter calc with the "Do not replace..." option disabled) applied to the original field. So for instance, if you want to filter a field to ensure that it contains only numerals or hyphens, you'd use a formula along the lines of: Filter ( ThisTable::ThisField; "0123456789-" ) Once this is applied, any characters not specified in the filter will be stripped out as soon as the user leaves the field. If you want several operations to be performed simultaneously, you can nest your actions (within the auto-enter/replace calc syntax) so that, for instance, the field reference in the above Filter( ) expression can be substituted with more complex expression (eg a 'phone formatting calculation) - whereupon both will be applied when the user exits the field. I used to develop in Clarion which has all the field level control you can wish for. Filemaker seems flexible, but is a lot more limited than what I'm used to. Why I switched? I'm on a Mac these days. As you get acquainted with the current version of FileMaker, you will probably begin to feel a bit differently about it. FileMaker has some quirks, but it is very powerful once you get into the 'right mind-space'. I doubt you will regret the choice - nor that you will continue to regard FileMaker as "a lot more limited" once you get going with it. Quote Link to comment Share on other sites More sharing options...
David Head Posted September 1, 2006 Share Posted September 1, 2006 I have a field for URL and would like to have HTTP:// put in the beginning of the field. Is there a way to run a script when you leave a field or do I have to pre populate it? In the field options, you can use the Auto-enter Calculated value with the formula: Case ( Left(URL; 4) = "http"; URL; "http://" & URL ) (uncheck the option "Do not replace existing value... so it does update the data) Also is there a way to format a field i.e ###-###-#### for phone numbers. In the field options, you can use the Auto-enter Calculated value with the formula: Left(Phone; 3) & "-" & Middle(Phone; 4; 3) & "-" & Middle(Phone; 7; 4) (uncheck the option "Do not replace existing value... so it does update the data) my last question is, how can you restrict the field to a limited set of characters? In the field options, you can use the Validation option - Validated by Calculation with the formula: Filter ( LimitedField ; "abcde12345" ) The problem with this is that the data is not validated until the record is committed. A solution is to script the data entry in the field say via a custom dialog. Depends on what you are doing. Filemaker seems flexible, but is a lot more limited than what I'm used to. Hmmm, I think what you meant was that YOUR knowledge of FileMaker is a lot more limited than that of what you are used to. FileMaker is usually not the limiting factor. Quote Link to comment Share on other sites More sharing options...
aknudsen Posted September 1, 2006 Author Share Posted September 1, 2006 Thanks all for the replies, this is great help to me. All the underlying stuff is similar in most development environments, but the front end and where to put the stuff for validations and calculations is what I need to come to terms with. Again, thanks for the help. Quote Link to comment Share on other sites More sharing options...
aknudsen Posted September 1, 2006 Author Share Posted September 1, 2006 Hmmm, I think what you meant was that YOUR knowledge of FileMaker is a lot more limited than that of what you are used to. FileMaker is usually not the limiting factor. That too. Oh Really! Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted September 1, 2006 Share Posted September 1, 2006 CobaltSky: The technique described by AHunter3 is the kind of thing that used to be necessary prior to the release of FileMaker 7. However since you are using v8.5 Advanced, there is a different approach that you may find preferable. I stil "think" in FileMaker 5/6. So many new techniques... I hadn't thought of using auto-enter calc in that fashion...cool 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.