Hi All,
i have a PickerFieldUser, which am auto-populating, but the user can cancel the auto-populated value and key in other entry,
auto-populating the user field is working fine, how can i make the field null when the user takes out the auto-populated data and key in his data, below is my code,
item: a!pickerFieldUsers( label: "Requestor", labelPosition: "JUSTIFIED", maxSelections: 1, value: local!Applicant, saveinto: a!save(ri!Request_Inputs.Requestor,local!Applicant), required: true, validations: {} )
Thanks in advance
Discussion posts and replies are publicly visible
Hi vineethk0001,
Use "placeholder" attribute to keep the user picker empty until user enter some other user.
a!pickerFieldUsers(label: "Requestor",labelPosition: "JUSTIFIED",maxSelections: 1,
placeholder:"--Select a user--",value: local!Applicant,saveinto: a!save(ri!Request_Inputs.Requestor,local!Applicant),required: true,validations: {})
Hope it helps!!
thanks for the reply Prateek , sorry but it dosen't work , as soon as i delete the autopopulated name , it comes back
Hi - I think you're over-thinking this. If the default value is being supplied in the value of ri!Request_Inputs then your code should simply be this:
a!pickerFieldUsers( label: "Requestor", labelPosition: "JUSTIFIED", maxSelections: 1, value: ri!Request_Inputs.Requestor, saveinto: { ri!Request_Inputs.Requestor }, required: true, validations: {} )
Give below code a try..as it works for me.
a!pickerFieldUsers(label: "Requestor",labelPosition: "JUSTIFIED",maxSelections: 1,placeholder:"--Select a user--",value: if(isnull(ri!Request_Inputs.Requestor),local!Applicant,ri!Request_Inputs.Requestor),saveinto:{ri!Request_Inputs.Requestor,a!save(local!Applicant,null)},required: true,validations: {})
Hi Prateek, sorry , its not working, it gives an error as null value cannot be passed , when i cancel the autopopulated user
this i tried Stewart , but its not working, as this field will be editable and user can remove the value present and add new value.
vineethk0001 said:i have a PickerFieldUser, which am auto-populating, but the user can cancel the auto-populated value and key in other entry,
That's what you said you wanted to do! Do you mean you want a default value added and that the User can only ADD to this value and only remove the values they have added but NOT remove the default User value?
No No, i want to have default value, if the user wants he can remove this default value and add his own value,
Ok, so I am confused. My original solution DOES satisfy your requirements. I tested it. So I don't understand why you then said:
vineethk0001 said:this i tried Stewart , but its not working, as this field will be editable and user can remove the value present and add new value.
...as this indicates that this is NOT what you wanted...please help me to understand what it is you want as it's not at all clear now.
Hi Stewart, my requirement is , on form load the "PickerFieldUser" will be populated with Default user(Logged in user), say "User1" will be populated, now the user who is filling the form can keep this "User1" or delete it and add "User2".
now whats happening is , on form load am able to populate "PickerFiledUser" with Defalut User(Logged in user),
but if the user wants to change this value and try to remove the default value to put "User2" into the field, its not leaving to do so, since as soon as i remove the defalut user, an event occurs by default (UNFOCUS or Keypress) which will again populate the "User1" into the field, not leaving me to key in "User2",
hope i was able to explain it properly