I have some view for every objects of array ($this->receiveList
)and there are 2 buttons(2 forms with input submit) for every objects too.
If i trying to change status value of someone of objects(models) - only one(1st) object will be changed(saved new value for status) by all 4 buttons. BUT ONLY 2 BUTTONS READY FOR THAT AND 2 for another object.
WHY ITS HAPPENING Guys?
Example img: http://s017.radikal.ru/i441/1510/c7/974e00e3f8be.jpg
$this->receiveList = Invite::model()->findAll( $criteria2 ); // array of 2 objects
for ( $key=0; $key <= count($this->receiveList) - 1; $key++ ) {
// yes
if ( isset($_POST['formInviteYes']['sendRequest']) ) {
unset($_POST['formInviteYes']['sendRequest']);
$this->receiveList[$key]->status = 1;
$this->receiveList[$key]->save(false);
$this->refresh();
}
// no
if ( isset($_POST['formInviteNo']['sendRequest']) ) {
unset($_POST['formInviteNo']['sendRequest']);
$this->receiveList[$key]->status = 0;
$this->receiveList[$key]->save(false);
$this->refresh();
}
print('<form action="" method="post" id="">');
print('<input type="submit" name="formInviteYes[sendRequest]" value="Согласиться"" class="inviteAnswer">');
print('</form>');
print('<form action="" method="post" id="">');
print('<input type="submit" name="formInviteNo[sendRequest]" value="Отказаться" class="inviteAnswer">');
print('</form>');
}