This topic is locked

link with each record on list page to execute a value edit

5/11/2009 1:17:18 AM
PHPRunner General questions
jwoker author

I would like a link for each record on a list page that would perform a specific edit to a record. An example would be a page that lists tasks - and I would like a link to mark the task done with one click.
I realize I could do this using some form of "with selected do.." but I just want the user to make one click on the particular record rather than clicking to select it and then click to do it.

J
Jane 5/11/2009

Hi,
it's possible but this task requires some custom coding.

Create link manually on the Visual Editortab. Here is a sample:

tablename_list.php?recordid={$FieldName_value}&action=update


Then check $_REQUEST["recordid"] and $_REQUEST["update"] variables in theList page: Before processevent and update selected records if needed.

jwoker author 5/11/2009

Not sure what you mean by "check" the variables in the before process add event?
In my example I believe you are saying to create an html link to task_list.php?recordid={$FieldName_value}&action=update . The code ends up looking like
<A href="task_list.php?recordid={$FieldName_value}&amp;action=update">Task completed</A>
The field I want to update is named task_completed it will start with a value of 0 and needs to be changed/updated to a value of 1. It seems to me that the variable $task_completed_value will be 0 where do I give it the value of 1.
Maybe I'm just confused why I would want the tasks "id" equal the field value. Can you be a little more specific with the link and event code given my example?
Table = task

Field to update = task_completed

initial field value ($task_completed_value) = 0

value to be given if link is clicked = 1
Thanks for your help

J
Jane 5/12/2009

Hi,
replace FieldName with your actual field name where key value is stored:

tablename_list.php?recordid={$FieldName_value}&action=update


Then check $_REQUEST["recordid"] and $_REQUEST["action"] variables in the List page: Before processevent and update selected records based on the key value:

global $conn;

if (@$_REQUEST["recordid"] && @$_REQUEST["action"]=="update")

{

$strUpdate = "update task set task_completed=1 where FieldName=".$_REQUEST["recordid"];

db_exec($strUpdate,$conn);

}