This topic is locked

Conditional Page Redirect

6/10/2008 9:18:15 AM
PHPRunner General questions
E
ericgordon author

Hi
Could you tell me the best way to do a conditional redirect from a list page to an edit page, based on a field value in the list page.
Example.
I have a list page showing a list of transactions, each of these transaction can be 1 of 2 types.
Depending on the transaction type I need to open either 'EditPage1' or 'EditPage2'
I'm not sure if this should be done within the list page or to use an event within one of the EditPages to do the redirect.
Thanks for any help, great product.

J
Jane 6/10/2008

Hi,
change edit link on the Visual Editor tab for this purpose.

Here is a sample:

{if $row.1FieldName==1}

<A href="TableName_edit1.php?{$row.1editlink}">Edit</A>

{/if}
{if $row.1FieldName==2}

<A href="TableName_edit2.php?{$row.1editlink}">Edit</A>

{/if}

E
ericgordon author 6/13/2008

Hi,

change edit link on the Visual Editor tab for this purpose.

Here is a sample:


Jane thanks for the help
Worked a treat.
Just wanted to let anyone else new to this, when using the the if statement you must use the _value at the end of the variable name
i.e.
{if $row.1FieldName==1} should be {if $row.1FieldName_value==1}
Cheers