AnsweredAssumed Answered

PAM 4.3.1 - IRF - Insert an empty element into a Select result

Question asked by J_W on Jan 30, 2017
Latest reply on Feb 3, 2017 by J_W

I am using a Select dropdown to pull a list of groups from SDM onLoad of my IRF.  The query is working as expected and I am populating the list using the sample code from the Pre-Defined Content examples, under User Interaction forms, section 08 - Populate Dropdown DB onLoad.


This is a required field.  However, it displays all the results and so it is possible for someone to actual skip this field because it will be pre-populated with the first element from the results.






I need to have this list start with an empty/blank element so it can't be skipped.  I've looked at the ca_pam_addValuesInSelectStore but didn't see a method of 'unshift' into the list after it is filled from the query. 



I have changed the DB query function from Form onLoad() to Form.NewHireGroup onClick.  This does start out blank on form load but onClick returns the first result into the field and the user must click it a second time to get the full dropdown list.



Do I need to do a conversion of the 'Form.NewHireGroup' object and then run JavaScript array.unshift() against that and return it from callback?


I have tried setting vars of emptyName and emptyValue and then tried to update the Form.NewHireGroup field after the select store is created using ca_pam_addValuesInSelectStore('Form.NewHireGroup',emptyName,emptyValue); but no effect.


I've also looked at the Lookup functions but could use an example of using the SQL function for the 'get' and returning that to the 'set' one.


I see this has been an issue before, I found these previous Questions marked 'Answered' but the OP didn't share the results.


Issue with lookup field in an IRF 

Click or Select Events on IRF Table?