This topic is locked

Inline Edit - Trigger Edit mode on page load

11/24/2007 05:28:15
PHPRunner General questions
A
acpan author

Hi,
This a simple question i hope.

  1. I have single record table.
  2. When user clicks the menu, it will show the list page with 1 line of record.
  3. the user can then click inline edit to edit the field and save.
    Now i want step 3 to be simplified. i.e when user clicks the menu,

    it will list the page with inline edited mode, like an invisible hand click the

    inline edit button, ready for him to enter the data.
    I though of changing the menu to point to the link for inline edit button.

    http://xx.xx.xx/y/z_edit.php?editid1=12323;

    i guess 12323 must be changed to a variable. what should be the format?
    Is there better way ? like using onload event etc, i try not to change default template link.
    Thanks

    Dex

J
jglyn 11/24/2007

Dex,
Try replacing 12323 with {$row.1id_value}
i.e.

http://xx.xx.xx/y/z_edit.php?editid1={$row.1id_value};

  • Josh

A
acpan author 11/25/2007

Thanks Josh,
i got this error:
Smarty error: unable to read resource.
Perhaps when i click on the menu's modified link, it got problem as it does not know

what is the row1 yet without loading the page. So changing at menu link for

this code may not work. (i am only guessing, i am new to this)
Is there a way do it in event code ? so that i dont modify the codes in the template.

Any advise or suggestion is welcome.
Cheers

Dex

J
Jane 11/26/2007

Dex,
try to use this code in the Menu page: Before Display event:

global $conn;

$str = "select id from TableName";

$rs = db_query($str,$conn);

if ($data = db_fetch_array($rs))

{

header("Location: TableName_edit.php?editid1=".$data["id"]);

exit();

}



where id is your actual field name, TableName is your actual table name.

A
acpan author 11/27/2007

Hi jane,
Thanks for your time. the error is the same.
When you copy the inline edit link and paste to

a new browser window, you will get the same smarty error.
It happen when i copy any inline edit url link

and paste on new browser window,

seems it needs to work within the same parent window

which contain the inline edit ?
Thanks

Dex