Warning "The name ... is not a valid indentifier for ..."

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Warning "The name ... is not a valid indentifier for ..."

Postby rph » Tue Sep 08, 2020 2:20 pm

Hi

Since we upgrade our solution with the Servoy-Framework from Servoy 2019.09 to 2020.03.1 we have hundreds of warnings in our log like:

The name '5907EB62-14B3-4835-BACC-35948D8C91EA' is not a valid indentifier for a component/form, please change this (avoid - or other invalid chars, replace those with _).

We figured out, that the problem is when it initializes the toolbars with the following Servoy-Framework-Code:
draw_item.png
draw_item.png (47.45 KiB) Viewed 1455 times


Obviously the rules for "Identifiers" has changed (or at least will now be proofed), so they must start now with a letter (not numbers like in the example) and must not have special characters like "-".

How could we suppress these warnings, so it will not fill our logs anymore.

Thanks in advance.

Best
Roland
rph
 
Posts: 75
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: Warning "The name ... is not a valid indentifier for ...

Postby Joas » Wed Sep 09, 2020 3:49 pm

I think the best solution is to make sure that valid identifiers are used, so change that line for example to:
Code: Select all
jsLabel.name = "lbl_" + item.toolbar_item_id.replace(/\-/g, "_");
Joas de Haan
Yield Software Development
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: Warning "The name ... is not a valid indentifier for ...

Postby rph » Wed Sep 09, 2020 4:49 pm

Hi Joas

Thanks for your reply. I'm not sure, if you or Sanneke created the code above ;-)

We've already tried that. And it works, at least as long as it is used for "normal" Toolbar-Items. But the problem starts, when the item is used to open a "Submenu"-Item. Then the Framework references the items of the submenu in the database with that key. So then we have to revert the identifier everywhere in the Framework where it is used as search-key. So maybe this is really the only solution to this problem.

Best
Roland
rph
 
Posts: 75
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland


Return to Programming with Servoy

Who is online

Users browsing this forum: Bing [Bot] and 13 guests

cron