This topic is locked
[SOLVED]

 Add button visibility and text

6/7/2018 3:57:05 AM
PHPRunner General questions
M
morellif author

Hi all,

I built an app using Bootstrap template. I modified the list page html in order to have 'Add' and 'Inlide Add' buttons visible on mobile (i made that just putting them in a <div> container that is not hidden on mobile). Now I would like to do 2 things :

  • change button text, didn't find how to.
  • hide one of the two Add button on mobile. How can i do?
    Any help wil be appreciated.

    many thanks

    F

admin 6/7/2018

You need to use jQuery for this purpose. As a first step you need to figure out button ID.

Here is the article that explains how to achieve this:

http://asprunner.com/forums/topic/25588-disabling-a-custom-button-till-some-records-are-selected/
And here is the code itself:

// hide button

$("a[id^=Copy_Selected]").hide();
// show button

$("a[id^=Copy_Selected]").show();
// change button text

$("a[id^=Copy_Selected]").text("New Label");
M
morellif author 6/9/2018

Thanks for the reply!

Now I know hot to make button visible/hidden but how can I check if the page is shown on mobile?

If [mobile] then $("a[id^=Add]").hide();

If ![mobile] then $("a[id^=Add]").show();
Shold I use css styles instead?

admin 6/11/2018

Yes, using CSS styles is easier. You can just hide those buttons if screen size is less than a certain value.
See an example here:

https://stackoverflow.com/questions/11796297/div-show-hide-media-query