Jump to content

Script Trigger playing up


This topic is 4356 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Everyone.

I have a layout with a description field and a note field.

The user types in a description then clicks a button, which runs the following script.

The script inserts the current date, the users name and the description and then a carraige return with the cursor flashing waiting for the user to type into the notes field.

All works well, but when I try to attach the same script as a script trigger to the description field so that when the user tabs out of the field the script automatically runs, it insets the date, name and description, but the cursor won't stay in the field. (the field is set to not be editable in browse).

I added a pause to the script which puts the cursor in the field, but when I click a previous or next button that scrolls through the notes, it adds a new date, user and description into the note.

Is there any way around this?

Excellent forum, thanks in advance

Milton.

Link to comment
Share on other sites

I am somewhat confused here: you say you have a description field and a note field. What's the point of repeating the description in the note field? For that matter, the user and the date should also be in fields on their own.

Link to comment
Share on other sites

I am somewhat confused here: you say you have a description field and a note field. What's the point of repeating the description in the note field? For that matter, the user and the date should also be in fields on their own.

Hi Comment.

The description is entered once by the user, when the note is created, and yes it is added each time the note is edited.

The note is an endless note that if edited automatically enters date user etc so that the user can only enter text into the note field, and the only way to enter text into the note field is by clicking the edit button (or hopefully by tabbing out of the descriptioon field) BTW the tabbing out of the description field only happens when you make a new note, after this the description field is hidden and the edit note button appears.

It is more to stop people altering existing info.

Milton.

Link to comment
Share on other sites

All the more reason to make each note a separate record.

Thanks Comment.

The user has the ability to create a new record i.e. new note - by clicking a new note button.

What I am trying to acheive is the ability to update/add to a note or thread as we do here in this forum, or say,

how messages are threaded on an iphone.

I take your point that adding the description each time is superfluous, so I will delete this step in the

edit note script, but leave it in the initial script that I want as a script trigger.

Back to my problem, how do I get the cursor to stay on the note field?

Link to comment
Share on other sites

The user has the ability to create a new record i.e. new note

I am not sure we are on the same page here. If they create a new record, they should be able to edit it to their heart's liking - since previous notes are in OTHER records. So the problem with the cursor should not exist at all.

Note also that with an "endless note" in a single field, once the cursor is in the field, users can edit ANY part of the field.

Link to comment
Share on other sites

I am not sure we are on the same page here. If they create a new record, they should be able to edit it to their heart's liking - since previous notes are in OTHER records. So the problem with the cursor should not exist at all.

Note also that with an "endless note" in a single field, once the cursor is in the field, users can edit ANY part of the field.

Definately on a different page.

I don't have any problems when the user creates a new note, yes they can edit it to their hearts content, the problem never existed with a new record.

As I have stated previously it is when the user EDITS the existing note.

If I use the script attached to a button it works.

If I use the script as a script trigger when I tab out of a field, the cursor will not stay in the field.

If I add pause/resume script it puts the cursor in the correct position, but causes the problem if the user clicks the previous or next button to go to other existing notes, it runs the script and puts new info into the note field.

The script is:

Set Selection [staffNotes::StaffNote; Start Position:0; End Position:0]

Insert Text [" "]

Set Selection [staffNotes::StaffNote; Start Position:0; End Position:0]

Insert Calculated Result ["---"& Get(CurrentDate) & " @ " & Get (CurrentTime) & "by" & Get(AccountName) & "---and then a carraige return"]

Pause/Resume Script.

Does anyone have any idea why the script would work attached to a button, but not work as a script trigger (without the pause/resume script step)

Milton.

Link to comment
Share on other sites

Definately on a different page.

As I have stated previously it is when the user EDITS the existing note.

And - as has been stated previously - that is not something they should be doing.

They should not be editing an existing note.

They should be making a new note record.

You are trying to solve the wrong problem; you should learn the improved design which has been recommended to you for good reason.

Link to comment
Share on other sites

This topic is 4356 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.