You need to sign in to do that
Don't have an account?
mluecke
Dynamic multiple Radiobuttons
I hope, anyone has a idea how to solve this.
I have a parent object with multiple child objects. The child objects create some kind of timetable, e.g. child1 and child2 start at 9 am and end at 10 am and child3 and child4 start at 10am and end at 11 am. In addition it may occur that there is one session longer. Like this:
The user should not be able to select parallel sessions or select the longer session and one of the parallel sessions. I will get the display done but I don't know how to save the selections. I need to create a link between the attendant and the selected sessions - generally I would work with Lists/Maps. How can I bind the selections to List elements?
I appreciate your help!
I have a parent object with multiple child objects. The child objects create some kind of timetable, e.g. child1 and child2 start at 9 am and end at 10 am and child3 and child4 start at 10am and end at 11 am. In addition it may occur that there is one session longer. Like this:
The user should not be able to select parallel sessions or select the longer session and one of the parallel sessions. I will get the display done but I don't know how to save the selections. I need to create a link between the attendant and the selected sessions - generally I would work with Lists/Maps. How can I bind the selections to List elements?
I appreciate your help!
Parallel (Short) Sessions, name the radio buttons the same name, e.g. name="row1RadioBtns". This will prevent both sessions from being selected at the same time.
Long Session, You can use Javascript to check if any other sessions at that time are checked. You can use onblur or onclick. Post your code and I can provide more help, if needed.
Still got more questions: I do not know how many sessions/session timeslots will be there (the image is just an example) and I would like to save all of the selected values from the radiobuttons. In addition I do not know whether there is a longer session or not (usually there will be NO long session). So I have n sessions, some parallel to each other. My approach would be to create a List (or a Map) of List<SelectOption> in the controller, where each List<SelectOption> is one timeslot (starting time) and to iterate with <apex:repeat> through the list of lists to create the radiobuttons for each timeslot. How to save the selected values of n <apex:selectRadio>? Is it possible to assign a List to the value-attribute of selectRadio and a new entry will be created dynamically? Or do I have to create up to 100 single variables to hold the selected value?
I'm at the beginning of this project, so I don't have any code to provide yet. It will be a three or four step registration process and I'm working on step two (just a simple name, company etc. form).
and I create a list of Ids to hold the selected sessions:
On the page I iterate over the map and create multiple selection lists:
When I leave the selectedSessions list empty, I receive an error:
Subscript is invalid because list is empty
So I prefill the list in the getSessionOptionsByName()-Method, for the page to render properly. But, whenever I change the session selection, the selectedSessions list receives a new entry instead of replacing the previous selection and when I go on to save the selected sessions to the attendant, ALL sessions which where previously selected (no matter whether they are still selected) are in the list.
Can anybody help with this? I only want to save the current selection, not all ever selected values.