JS – how to refer to a field in the code
- This topic has 2 replies, 3 voices, and was last updated 2 years, 9 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Home › Forums › Modern DFFS › JS – how to refer to a field in the code
Hi Alexander,
When someone submits a new or edit form I want to look at a certain field and find the character “;” and replace it with “; “. I have Javascript code that can do this but I am not clear on how to target this to a specific field in the form. Are you able to provide me some guidance on this?
Thank you!
Hi,
If you look at this thread and find the Do something before the item is saved section you can just use getFieldValue(“Your_field_name”) to get the value to build your new variable with the changes, and setFieldValue(“Your_field_name”, your_variable); to write it back to the field.
Alexander
Wendi,
Also note that this works great for Lookup fields. So
getFieldValue(“your_field_name”);
returns the VALUE in the field not just the ID of the item being looked up.