Button with 2 labels/imaged

Status
Not open for further replies.

jmdc

Member
Hello,
I am trying to have 1 button php for each row in list view which label /image or php runcode depends from the value of other element in this row.if these element =1 then this button will run php1 code.if the element value =2 then the button will run the php2 code and changing the labels/image from that button. Is this possible? Thank you all.
 
Thank you for your answer.
Can i have at least a link element, which url can change depending on other value element from this row?
 
Yes. Use a calc element to build a link based on your other element data.

Technically you could probably use a calc to build a button which triggers an AJAX call and write a user_ajax.php method to process it, but like I said, that's a lot of coding.

Sent from my HTC One using Tapatalk
 
Why these php code is not working in the calc element? It?s multiplicating all the row by 5 even if $myCalc=2

$myCalc = (int)'{esc_alunos___EstadoAluno}';

$myCalc2 = (int)'{esc_alunos___EstadoAluno}' * 5;

if($mycalc == 2 ){
return $myCalc;
} else {
return $myCalc2;
}

Thank you.
 
Variables names in PHP are case sensitive. So $mycalc doesn't exist. So it doesn't == 2. So you always return $myCalc2.

-- hugh
 
Is that possible to only edit a row if a element =1. If these element in this row is = 2 then the user can not edit the row.he will only be able to see datas.About the first question i have found another solution that i will put here this afternoon. Thank you.
 
It?s really what i was looking for...thank you.

My first solution for the button is to have a calc element with these code:

$estado = '{esc_alunos___EstadoAluno_raw}';

if($estado == 2 ){
return "<a href=\"index.php?option=com_fabrik&view=form&formid=5\"><img src=\"http://xpto.com/images/image1.png\" border=0 ></a><a href=\"index.php?option=com_fabrik&view=form&formid=5\"> TEXT1<br>(text1)</a>";
}
else {
return "<a href=\"index.php?option=com_content&view=article&id=7\"><img src=\"http://xpto.com/images/image2.png\" border=0 ></a><a href=\"index.php?option=com_content&view=article&id=7\"> TEXT2 (text2)</a>";
}
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top