Different language terms

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

Different language terms

Post by JAW »

Hello,
I have a project I which am using the Gridadd option on some tables. I have a number of Required fields but when I select Gridadd the red asterisk is not showing so the person entering the data has no way to know which fields are required, not all are. I added a red asterisk in the field name but on the List page when not in Gridadd it displays two red asterisks. I need to have this so it is displaying the red asterisk during Gridadd. Has anyone found a fix for this? It is possible to change the language term when entering Gridadd?

Regards,
JW


mobhar
User
Posts: 11660

Post by mobhar »

Simply enclose your code with if condition as follows:

if (CurrentPage()->CurrentAction == "gridadd") {
// your code goes below this line

}


JAW
User
Posts: 98

Post by JAW »

I had already tried to use the Language_Load Server Event without success. Here is what I tried;

if ($this->CurrentAction == "gridadd" OR $this->CurrentAction == "gridinsert") {
$this->setPhrase("Shift Type", "Shift Type <font color='#FF0000'>*</font>");
}

So using your suggestion I then changed it to the following;

if (CurrentPage()->CurrentAction == "gridadd" OR CurrentPage()->CurrentAction == "gridinsert") {
$this->setPhrase("Shift Type", "Shift Type <font color='#FF0000'>*</font>");
}

But neither of the above worked.

The Help file has the following;

$this->setPhrase("MyID", "MyValue"); // Refer to language file for the actual phrase id

So I looked in the Language File to find the "MyID" but all I can find for Shift Type is <phrase id="fldcaption" value="Shift Type" /> but that doesn't tell me an ID for Shift Type in the Language file.

Regards,
JW


JAW
User
Posts: 98

Post by JAW »

Hi,
In Language_Load Server Event I tried to use just

$this->setPhrase("Shift Type", "Shift Type <font color='#FF0000'>*</font>");

So it would not be checking the CurrentAction or CurrentPage and it still does not work. It does not change the language of the field name.

Any other suggestions?

Regards,
JW


mobhar
User
Posts: 11660

Post by mobhar »

Then inspect the element id/class, and use jQuery .html() to change the html code of the element by adding the red * character inside.


JAW
User
Posts: 98

Post by JAW »

In this case the Element Class is ewTableHeaderCaption but I don't want them all changed, only the ones that are required. I think I need to find a way to make the change on the language level not the class level. I am hoping there is an answer to this.

Regards,
JW


mobhar
User
Posts: 11660

Post by mobhar »

JAW wrote:
In this case the Element Class is ewTableHeaderCaption

No, it is not. If you are in GridAdd mode/page, then when you inspect the table column, each column has the difference class/id.

For example, when you are in GridAdd of "suppliers" table page, then the "CompanyName" table header column has its own id selector is "elh_suppliers_CompanyName", and its class name is "suppliers_CompanyName".


Webmaster
User
Posts: 9425

Post by Webmaster »

JAW wrote:
$this->setPhrase("Shift Type", "Shift Type <font color='#FF0000'>*</font>");

That is wrong. There is no such phrase ID. To set field caption use: (assume your field name is "ShiftType")

$this->ShiftType->Caption = "Shift Type <span class='ewRequired'>*</span>"; // Also, avoid using out-dated <font> tag any more


JAW
User
Posts: 98

Post by JAW »

Thank you, that worked exactly as I needed.

Regards,
JW


Post Reply