Forums

Binary with associated model

bmurphey 06 Feb, 2016
I am unable to get a binary action to work with a 'state' field in an associated model. The relationship of the main model to the associated model is "hasOne." The db 'state' field I am trying to toggle is tinyint(1).

I added an identically configured 'state' field to my main model and tested the binary action with it, just to make sure I was doing everything correctly, and it worked fine. But it won't work with the associated model. Could it have something to do with the relationship? Any other ideas?

Many thanks -

-Brian
Max_admin 29 Feb, 2016
Hi Brian,

Did you include the model id ? like this:
Model2.state


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
bmurphey 03 Mar, 2016
Yes, I did. However, since I was unable to solve the problem, I restructured my databases, so Binary with the associated model is no longer required. Thanks, though!

-Brian
bmurphey 03 Mar, 2016
In case I ever want to do this in the future, I decided to try again with a test listing. It still doesn't work. Here are the images from my set-up.

model1: [attachment=0]model1.PNG[/attachment]
model2:[attachment=1]model2.PNG[/attachment]
The frontlist column settings:[attachment=2]frontlist1.PNG[/attachment]
And the frontlist binary settings:[attachment=3]frontlist2.PNG[/attachment]
The result:[attachment=4]result.PNG[/attachment]

Clicking on the Model 2 State button never results in the state changing.

Thanks -

-Brian
Max_admin 07 Mar, 2016
Your setup looks correct to me, assuming the foreign key is correct (room_id), what happens when you click the "Model 2 state" icons ?

You may also enable the debugging in your list config to check the generated sql data.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.