Error In Placeholder


I want to put the error message generated by yii inside the placeholder of the same field not outside.

And the second question is how do I made a log transactional that saves on the databases the following values:

username, insert, update that made this user.

Somebody know if there is some extension or a manner to making like I want, something like this:

user = I name made: insert (‘field1’) set (‘value’)…

I found examples like this:



but doesn’t made what I want that is get all the writing query:

UPDATE “table” SET “field”=‘field’s value’ where…

I have been trying made this with triggers (postgres) but how do i know which user made a change if triggers doesn’t accept parameters.

Thank you.

Please ask each question in a separate thread.

See the source of the CHtml.error method and how it retrieves the error message for an attribute and renders it.

Then you can extract that error message yourself and put it in the ‘placeholder’ attribute of an input field. I don’t know why would you want to do that though, because if the input field is not empty the placeholder won’t show up. And when rendering a form with errors, all the previously entered values should be there. Otherwise, you will make lots of users angry.

I do it with triggers in PostgreSQL. I was heavily inspired by an example in the manual about triggers and auditing. I make sure each table I want to track has a ‘last_editor_id’ column where my app inserts current user’s id on each UPDATE and INSERT. DELETE is tricky, I have to do another UPDATE right before it.

I copy the whole row, even if just one column changed to keep the triggers simpler. I don’t care about the space it takes because I got little traffic and it’s easier to populate a model using a whole row than gather each value possibly scanning the whole log table.

Also I would recommend this article on slow changing dimensions. There are some cool examples what kind of audit logs are used.

At last I would suggest the AuditTrail extension. Maybe you want to do it this way.

Can you borrow me the code because i don’t know how to do it.

No, sorry. It’s too big, complicated, undocumented, dependent on other stuff and generaly not ready to be made public.