Jump to content

Set field (or variable) to selected field script


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

Recommended Posts

Hi,

I'm not sure where to start on my script, but the plan is:

I have 3 fields, Field A, Field B and Field C

Each displays calculated data (in this instance dates) and each field is a button. I'm trying to get it so that when the user clicks one of the fields, it sets another field (or variable, but I don't have much experience with those) to that field's value.

I could create 3 scripts, one for each field. I could also create a script that selects the contents of the selected field and copy and pastes it into another field. But both these methods seem a little cumbersome.

Does anyone have any ideas how i can do this in a single script suitable for all fields? I'm thinking something like:

"Set Field X to Current Field", but I'm not aware of any such script step.

 

Thank you in advance for any help.

Link to comment
Share on other sites

34 minutes ago, Ninja said:

each field is a button.

When a field is formatted as a button, the user clicks on the button, not on the field - and the underlying field does not become active in the process.

 

37 minutes ago, Ninja said:

how i can do this in a single script suitable for all fields? 

Use a script parameter and attach a different parameter to each button.

Link to comment
Share on other sites

Use script parameters as Comment said to tell the script that which button has been clicked. 

 

Instead of adding buttons on top of fields, use script triggers to run the script. Either "on object entre" or "on objecmodified" (if I am not mistaken by names of triggers. ;)

Link to comment
Share on other sites

Ah script parameters. I've not used those before but they worked perfectly! Thank you.

I elected to set the fields to buttons rather than using script triggers (thank you for the suggestion siroos), as entering the fields cause them to look slightly odd, and the parameters were able to predict the field's content in the way I was using them.

Thank you both for your help.

Link to comment
Share on other sites

This topic is 2819 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
×
×
  • Create New...

Important Information

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