I have a template that corresponds to a table in the database and I need a form to edit only one field of that table, this table is made up of two primary keys.
For example, I have a table with 3 attributes, ID, ID2, and Name (Both ID and ID2 are primary keys). When I enter a user profile, I want it to fetch both ID's and only change the name field. What do I need to do?
I've already tried to create a form in the views where I want it to appear, and a function in the template that fetches the ID's from the user I'm searching. I can see the 'Name' field of that user, but I can not edit it.
Don't know exactly your problem. But for fetching list of primary key, you can use $yourModelInstance->primaryKey().
And about the name field to be updatable, you must specified rules for it in your model::rules function. Yii2 check for input rules before saving data as yii2 instructions. Here's an example:
in your Model class:
public function rules()
{
return [
[['name'], 'string'],
[['your primary key 1', 'your primary key 2'], 'int'],
];
}