mga Posted February 15, 2006 Posted February 15, 2006 I've got a comments text field in my database. I'd like to have a button which adds a user's name and the date to the top of the text field, and then positions the cursor beneath it so they can add text. The aim is that users can keep adding comments, with the newest always at the top and the facility to scroll down to see older comments. How can I pull this off? It occured to me that I can cut the entire contents of the field, insert the username and date, and then paste back the field contents. This would be fine, except that it requires the user to position the cursor before typing. I'd rather have the cursor automatically in the right place. I'm on MacOS, so could probably pull it off with an AppleScript, expect that I need this solution to work under Windows as well.
Ted S Posted February 15, 2006 Posted February 15, 2006 mga, This can be done pretty easily. Here is generally how it is done: Use the Set Field scrip step to make your big notes field equal to a couple of carriage returns & itself. Set Field [YourField; "¶¶" & YourField] (it may not be obvious but you can indeed set a field equal to itself) Then in the next step you can add: Set Selection [YourField; Start Position 1; End Position 1]
comment Posted February 15, 2006 Posted February 15, 2006 I think you'd be better off with a separate record for each note - see here.
mga Posted February 15, 2006 Author Posted February 15, 2006 Thanks, that works. I used a solution similar to the first one, with these adaptations: Set Field [YourField; ¶ & ¶ & ¶ & YourField] Set Selection [YourField; Start Position 1; End Position 1] Insert Calculated Result [ ... & ¶] with a calculated result giving the string ">mm/dd/yy username". This adds in the information I want, and puts the cursor in the right position for user entry.
Ted S Posted February 15, 2006 Posted February 15, 2006 Cool. You could probably use Set Field instead of Insert Calculated Result but it sounds like it works for you.
Recommended Posts
This topic is 7249 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now