How to make CHtml::button refresh 1 attribute

I have a standard form. I would like to add another button to "Update" only 1 attribute. How can I do this?

If I use


CHtml::submitButton($model->isNewRecord  ? 'Create' : 'Save');

It will try to submit the entire form. I don’t want this.

So I tried


CHtml::submitButton($model->lastName ? 'Save' : 'Save');

But it still tries to submit the form. Please help.

edit: looks like I’ll need to use Jquery in options.

Thanks.

Yeah, might need javascript here, as a form is a form, your browser will submit the whole thing. BUT you could do what you are doing with the different submit name and check with that on the server side, and if it’s “save” and not “create” then only assign the value you want to update to your model and then save it.

I fixed my problem. Although I think my request for a "refresh" was incorrect.

I needed to get the values of a form field, but I needed to get it BEFORE it was saved. I had the proper code in my _form, which worked to an extent but not the way I wanted. I placed the proper code in my controller actionCreate and it activates right before it saves.

However, this option still interests me and when I have more time I will look into it.