Default Username based off of a Choice selection

  • 15 November 2016
  • 3 replies
  • 4 views

Badge +7

I was wondering if it is possible to default the current user in a People and Group field, and the days date in a date field, ONLY when a certain choice is selected. 

For Example:

194272_pastedImage_1.png

When the "Buyer Status" is set to "Completed", I would like "Buyer Completed By" and "Buyer Completed Date" to auto-populate with the current users name and the days date automatically. I know it would be possible to do within the workflow, but I'm interested in doing it at the moment it is done. Thanks in advance. 


3 replies

Userlevel 5
Badge +14

to achieve your requirement you will need to build small javascript.

basically, you need to define customized onchange handler for status dropdown.

withinh the handler you have to set the other two controls.

an example how to set date control you can find eg. here  

to set buyer completed by control is important to know what type it is of - people&group or simple text control?

Badge +7

It is a People and Group type

Userlevel 5
Badge +14

ok.

for how to set people&group control from javascript have a look on PP API and add() function usage example.

Reply