This topic is locked

greyed out

4/9/2008 1:34:39 AM
PHPRunner General questions
P
pnutz author

I need to have a user add data to a text field and update that text field later with out removeing previous comments ...

A
alang 4/9/2008

I assume you are asking about the ability to edit field contents - if not, can you expand on your question. Do you have "edit record" checked on the "Choose pages" tab? You also need to have the appropriate boxes checked on the next tab "Choose fields".

P
pnutz author 4/9/2008

Ok
here is what I need. user adds a comment in field (Exp Comments) ... I need the text to stay static in the the database and only allow the user to add more comment's to the record with out deleting or changing any of the previous data ...kind like logging

J
Jane 4/10/2008

Hi,
you can do the following:

  1. edit SQL query on the Edit SQL query tab.

    Here is a sample:
    select commentsField,

    commentsField as commentsField2,

    ...

    from TableName


2. check off commentsField2 on the edit page only on the Choose fields tab, set up commentsField as readonly on the "Edit as" settings dialog on the Visual Editor tab.
3. add following code to the Edit page: Before display event:

$smarty->assign("value_commentsField2","");


Then combine old and entered values in the Before record updated event:

$str = $oldvalues["commentsField"]." ".$values["commentsField2"];

$values["commentsField"] = $str;
unset($values["commentsField2"]);

S
steveh 4/10/2008

You'd need to do something like select commentsfield,'' as commentsfield2
otherwise you'll have a screen that reads
"comments....."
and the edit would look like this:-

"Comments....."
And the eventual string would be "Comments....Comments.....New comments"

P
pnutz author 4/10/2008

Great
Thank you....