I am looking for a way to remove or disable a combo box choice after it is selected and user submit the form.
I have an app for student to vote on his/her assigned projects.
What the app does?
Student has to vote for the assigned projects from the most interested to the least.
Each student is assigned to 4 projects.
Once the student selects the assigned project name, selects his/her class, selects the interest scale and enters a brief comment then submits the form.
The data is then written to the SharePoint List.
What I am looking for?
Once the student submitted the form for each project choice, I need the submitted choice to be disabled. He/she can only vote once for each project and not able to go back and edit once the form is submitted.
Once all 4 assigned projected is voted and submitted then the Project Name Combo box choice will also be disabled.
Question?
Is this even possible in power app? I am willing to listen for alternative recommendations.
This is a screenshot of the editform app.
Thank you.
Solved! Go to Solution.
It could be that you are actually saving the entire Record from the ComboBox. I imagine there is a way to get what you want from that record, but I would need to see the data. The easiest thing may be to set a variable to just the project name before you Submit the form. In the OnChange of the ComboBox use:
Set(var_Proj, Self.Selected.Value)
Then change your RemoveIf to:
RemoveIf(col_Projects,Value=var_Proj)
That should get you what you need
Will this all be filled out in 1 session? That would make things easier.
You could use a Collection to hold the DropDown choices. Then as each project is submitted you would just remove that choice from the collection. Once your collection becomes empty (you can check with the IsEmpty() function) then you can use that to set your DropDown's Visible property.
If they can do this over more than one session, you will need to complicate things a little with the SaveData function for your Collection
Thank you for your quick reply Brian.
I never work with Collection so not sure how to pursue from your tip.
I will look on Microsoft Document and if I am able to solve this by using Collection then I will accept your reply as solution.
Collections are just a way of saving tables or fields into the memory of the device for quick retrieval. You would create the collectio in the OnStart of the app. Something like:
ClearCollect(col_Projects,["Project1","Project2","Project3","Project4"])
Then your ComboBox would have col_Projects in the Items Property. Once someone filed out the form you would add some code after the Form was submitted:
RemoveIf(col_Projects,Value=Form.LastSubmit.ProjectName)
substituting the name of your Form and the field name
For the Visible Property of your ComboBox you would use:
!IsEmpty(col_Projects)
which make make it invisible when the last Project form is filled out.
Hope that gets you started
OnSelect of IconAccept1's Property I have the below code.
SubmitForm(EditForm1); RemoveIf(col_Projects,Value=EditForm1.LastSubmit.'Project Name')
However, it is giving an error. Here is the screenshot of it.
It could be that you are actually saving the entire Record from the ComboBox. I imagine there is a way to get what you want from that record, but I would need to see the data. The easiest thing may be to set a variable to just the project name before you Submit the form. In the OnChange of the ComboBox use:
Set(var_Proj, Self.Selected.Value)
Then change your RemoveIf to:
RemoveIf(col_Projects,Value=var_Proj)
That should get you what you need
Thank you so much Brian.
It worked.
Hi Brian,
Since each student is assigned to the same 4 projects for them to vote on, I like to only remove the voted project choices per student after they voted.
Example:
Student A, Student B and Student C all have been assigned to the same Project A, B, C, and D.
Student A voted on his Projects A, B, C, D then he is done. Next time he logs into the app, he should not see any choices appear in the Project combo box.
Meanwhile, Student B has not voted for his projects and he should see all 4 project choices on his Project combo box after he logs in.
How can I accomplish this?
In that case I would add a Boolean field to the Student's record (StudentVote). Once the student submits a vote, change that value to true. Then you can set the DisplayMode of the project selector based on that new field:
If(StudentVote, DisplayMode.Disabled, DisplayMode.Edit)
User | Count |
---|---|
172 | |
92 | |
74 | |
70 | |
58 |
User | Count |
---|---|
215 | |
161 | |
97 | |
92 | |
73 |