Show a specific row in a databasejoin based on field selected in a different page

Suzzi

New Member
I'd like to pass two values from one list (from two different database tables), and use them in cascading databasejoin dropdowns on another form (a third database table):

I have a list called 'Schedules', the list shows data from two tables : 'COURSE_DETAILS' (PK=course_id) and 'COURSE_SCHEDULE' (PK = course_schedule_id, contains the field 'course_id'). A course can have many schedules. The primary key/main table on the list is the course_schedule_id.

When I click on a field 'book now' on that schedule list I open up a form in a different page called 'Book a Course'. The user will enter in their details into this form and save it to another table 'COURSE_BOOKINGS' (PK=booking_id, a schedule can have many bookings, the course_id and course_schedule_id are both saved to this table also)

What I want to do, and can't figure out how, is to pass both the 'course_id' and the 'course_schedule_id' from the row selected on the schedules list to the booking form. And use it in the booking form to select a specific row in the databasjoin dropdown field for 'courses' which uses a cascading dropdown to filter the course schedules for that course. The rows defaulted in the dropdowns should be based on the course_id and course_schedule_id passed to this form.

i.e. I don't want to open up the booking form for the course_schedule_id value (which would happen if I passed the rowid in the URL), but I want a new booking row to be displayed, and have the COURSES.course_id and COURSE_SCHEDULE.course_schedule_id dropdowns in the booking page defaulted to the course_id and course_schedule_id of the row selected in the original list on the previous page.
 
You can see the forms in use at hiberniantraining.ie (click on any 'Book Now' on the list near the bottom of the home page), and on the form that opens I just want to default the course dropdown to the value selected on the home page list.
 
I presume you are using a custom detail link on that "Book Now" element?

In which case, you can append query string args for whatever you want to set on the form, by appending ...

&bookacourse_form___course_id_raw={htc_all_courses___course_id_raw}

... or whatever the appropriate mapping of element names it is you need, for each of the elements on the form you want to preset.

NOTE - in order for this to work with a CDD element, you'll have to update to the latest github, as I just fixed an issue that was preventing the query string thing from working for CDD's.

-- hugh
 
Thank you thank you. I spent ages trying to get at the value, not having ever done any coding like this so didn't realise until after lots of googling that I needed a ? where the & is above...and voila it all worked straight away.
 
Elements changing name to different table

Actually, my joy was short lived.

I had a list on my homepage working perfectly. Nothing complicated. After I did the github update today for the CCD element mentioned above, my list on the homepage displayed an extra checkbox. So I went through the settings to see if there was anything turned on that shouldn't be. I went into one group , changed an access level for editing, then checked the website and my table on the homepage is now looking for elements from the schedule table rather than the course table. It gets worse.

All the elements on that form (its a joined list from course + course_schedule) are now named course_schedule_table_field_name, even those fields that were originally from the courses table. I've tried adding new lists using the course table but as soon as I do anything they lose their full_element_name of course__ and change to full_element_name of the course_schedule table. Basically any way I try to get the course details into that list of course_schedules results in the full_element_names of the course fields being changed to course_schedule_

Even worse, now when I look at the elements for one of the groups, it's showing up two elements per field. On the database there is only one row per element. Image attached.

I've purged the cache, rebooted, check the fabrik updates (the github install seemed to go fine, I ftp'd all the files up to the the server and followed the post update instructions)

I then started the list again from scratch and got it all looking exactly like it should, and was going back through everything to see if some setting might be making the extra space between the list title and the list (seems to be a button area but I have no buttons) and suddenly all the 'course' elements in the list have changed into course_schedule_element_name again.

I've spent hours trying to get my list back working, any ideas? I don't ever click on 'update database' or do anything strange.

Suzzi
 

Attachments

  • one element two rows.jpg
    one element two rows.jpg
    58.7 KB · Views: 185
  • db table says courses table here but elements showing schedules table.jpg
    db table says courses table here but elements showing schedules table.jpg
    48.8 KB · Views: 164
  • weird_element_name_changes_b.jpg
    weird_element_name_changes_b.jpg
    65 KB · Views: 176
I've noticed that the size of the backup I took this morning before doing the github update was 43MB and this evening the backup is now 58MB. No content has been added to the site.

I've got the list working again, but don't want to touch anything in case it goes all weird and breaks the site again (it's live), so I'll go back to this mornings version of the site and hope that the CCD (my original problem) works without the github update...
 
I've restored the site back to the state it was in immediately before I did the github update and it's all working, no problems. It seems to be stable now.

And my cascading dropdown is defaulting to the value I'm passing it, which was the fix I thought I needed the github update for. So all's working well.

I don't know what happened and I'll have to assume it was something I did that was causing the instability rather than the update, if I'm the only one having problems.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top