add button with label

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
alescotti73
User
Posts: 57

add button with label

Post by alescotti73 »

Hi, the ADD button (the one made with a square box with the + symbol inside) has a tooltip on mouse over, but I'd like to have a label always visible on the page, how could I do it?


sangnandar
User
Posts: 980

Post by sangnandar »

Use jQuery Startup Script:

The element structure of generated page should be something like this:
<a ... class="btn btn-default ewAddEdit ewAdd btn-sm" ... >
<span ... class="glyphicon glyphicon-plus ewIcon" ...></span>
</a>

What you need to do with Startup Script are add style="display:inline;" to <span> element and put "Your Text" into <a> element. Then the above element structure should be changed into something like this:
<a ... class="btn btn-default ewAddEdit ewAdd btn-sm" ... >
<span ... class="glyphicon glyphicon-plus ewIcon" style="display:inline;"...></span>
Your Text
</a>

So here it goes:

  • find <span> element with jQuery selector, should be something like this: $("span[class='glyphicon glyphicon-plus ewIcon']").
  • add style display:inline; into the selected element (google how to add/append style to an element with jQuery), probably something like this: $("span[class='glyphicon glyphicon-plus ewIcon']").css('your style');

Repeat them with <a> element.

Good luck.


smpsrllc
User
Posts: 72

Post by smpsrllc »

In Client Scripts -> Global -> List Page -> Startup Script

Put this:

$("span[class='glyphicon glyphicon-plus ewIcon']").append('Your text');


kirondedshem
User
Posts: 642

Post by kirondedshem »

All buttons and links by default show icons instead of text
BUT
If you mean instead of the add button showing a plus sign, you want it to show its text instead, ie you want it to read "add", then you can disable the icon class on it from language phrases, if you do so it will show its text instead, you can aslo customise what text it shows, put below code in page_load

// Page Load event
function Page_Load() {

	//echo "Page Load";
	
	
	//force add button to use text instead of icon by removing the icon class
	Language()->SetPhraseClass("addlink","");
	
	//change add caption to whatever you want
	Language()->SetPhrase("addlink","My Add Caption");
}

HINT:refer to english.xml language file in phplang to see how every phrase looks and find one you want and tweak, also read in help menu about language files


Post Reply