This topic is locked

Change Row Button Label based on record value

6/27/2025 4:13:50 PM
PHPRunner General questions
A
asawyer13 authorDevClub member

I want to be able to change the label on a button that I have in my list page. The button is on each row.

How can I do this?

Thanks
Alan

ChatGPT 6/27/2025

Certainly, Alan! In PHPRunner, if you want to change the label of a button that's present on each row of your list page, you can do this by using the "Edit" section in the properties of that button.

Here are the steps to change the button label:

  1. Open PHPRunner: Launch PHPRunner and open your project.


  2. Navigate to the List Page: Go to the page that contains the list where the button is located.


  3. Select the Button: Click on the button that you want to modify. This could be a custom button you've added or a default action button like "Edit", "View", or "Delete".


  4. Edit Button Properties: Once the button is selected, look for the properties panel (usually on the right side of the screen).


  5. Change the Label: Find the property labeled "Caption" or "Label" (the exact name may vary depending on the type of button). Change the text to whatever you want the button to display.


  6. Save Your Changes: After changing the label, make sure to save your changes.


  7. Preview the Changes: Use the preview feature to check if the button label has changed as expected.



If the button is generated dynamically (like a custom button with an event), you might need to write some custom PHP or JavaScript code to set the button label based on certain conditions.

Let me know if you need further assistance or if there's a specific type of button you are working with!

A
asawyer13 authorDevClub member 6/28/2025

These auto ChatGPT suggestions generally don't help at all, and then since there is a reply made I think people don't look at the posts.

Just my opinion.

Alan

Sergey Kornilov admin 6/28/2025

You do realize that you are excplicitly selecting to include AI summary when you post a question?

img alt

C
cristi 6/28/2025

Something like this on list page javascript onload - I changed the label on each custom button from the grid's row using the value of a field in the list page as example:

var allRecords = pageObj.getAllRecords();
allRecords.forEach( function( row, idx ) {
var ctrl = row.getFieldText("field_name"); //your field name
pageObj.findItem( 'custom_button', allRecords[idx].recordId() ).find('a').text(ctrl); //replace custom_button with item id from the page designer; this is the code to change the label on custom button in grid, how you populate .text() argument it is up to you, I just gave you an example using another field value from the row for each button
});

img alt

A
asawyer13 authorDevClub member 6/28/2025

This is what I see when I click on New Topic, so no I don't realize it becaues I never see what you posted.

img alt

A
asawyer13 authorDevClub member 6/28/2025

cristi,
Thanks. Worked perfectly.
Alan

A
asawyer13 authorDevClub member 6/28/2025

How do I hide the column in the list that I base the label on, but don't want to see that column? I tried removing it from the list but then the Button Label doesn't pick up the label that I want.

A
asawyer13 authorDevClub member 6/29/2025

Thanks

A
asawyer13 authorDevClub member 6/29/2025

I've tried marking as Solved a couple times but it doesn't seem to save.

img alt