This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I created custom button with handler onRelationButtonAddAnonymus, then in my controller i call
public function onRelationButtonAddAnonymus()
{
return $this->onRelationManagePivotForm();
}
public function onRelationManagePivotForm()
{
$this->beforeAjax();
$this->vars['foreignId'] = "1";
return $this->relationMakePartial('pivot_form');
}
and i get error method beforeAjax not defined... In RelationController that method is private, when i change to public all working. Im implementing relationController in my main controller class
Maybe this can work
public function onRelationManagePivotForm()
{
$this->asExtension('RelationController')->onRelationManagePivotForm(); // this call will execute $this->beforeAjax internally
$this->vars['foreignId'] = "1";
return $this->relationMakePartial('pivot_form');
}
Yep, but $this->vars['foreignId'] = "1" wont be passed... Wen i run code in my model i get forgen_id = null :( Apparently Ajax func need to be called to $this->vars can bee used, or is ther some other way?
Aha!!! You can pass var as second argument to relationMakePartial method like so
return $this->relationMakePartial('pivot_form', ['foreignId' => "1"]);
1-5 of 5