This topic is locked

Query Read only item.

2/18/2007 5:50:00 PM
PHPRunner General questions
K
kenny_robb author

I have a table which has been automatically populated from another query.
I have added a form via visual editor which has list and edit.
I want to be able to keep some of the fields read only and then change some of the fields from a Y to a N and then use events to drive other stuff.
In order to do this I need to be able to select inofmation from a number of other tables. Problem is the main field I need to do this is one of the read only fields. Is there a way round this?
Thanks Kenny

Alexey admin 2/19/2007

Kenny,
you can get the values of readonly fields using $data array.

Here is the code for BeforeEdit event:

global $data;

echo $data["FieldName"];

K
kenny_robb author 2/19/2007

Kenny,

you can get the values of readonly fields using $data array.

Here is the code for BeforeEdit event:


I have put the code into my event and changed the field name and I still get nothing. Have I misunderstood. Do I have to use this as part of a query statement.

Sergey Kornilov admin 2/19/2007

Kenny,
post full event code here. Probably there is something that you missed.

K
kenny_robb author 2/20/2007

Kenny,

post full event code here. Probably there is something that you missed.


[codebox]function BeforeEdit($values, $where)

{

global $data;

echo $data["event"];
global $conn;

// Get ID_event based on displayed event
$strSQLQuery="select ID_event from elo_event where event='".$data["event"]."';

$reQuery=db_query(£strSQLQuery, $conn);

$data=db_fetch_array($rsQuery);
echo $data["ID_event"];

} [/codebox]
I have much more complex stuff in there but as I can't even seem to see the the first echo of the "event" then I'm guessing it's not working.
"event" is the read only field I am trying to read from the visual editor form.

Alexey admin 2/20/2007

Kenny,
I'm sorry, my fault.
You can not use $data array in BeforeEdit and AfterEdit events because it's not created yet.

Use this expression to obtain readonly field value:

echo postvalue("value_event");

K
kenny_robb author 2/20/2007

Kenny,

I'm sorry, my fault.
You can not use $data array in BeforeEdit and AfterEdit events because it's not created yet.

Use this expression to obtain readonly field value:


Thanks that worked great...