Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 10 Monaten
Letzter Beitrag:
vor 1 Jahr, 10 Monaten
Beteiligte Autoren:
JP, Fabrice Harari

[WB21] - CreateClone

Startbeitrag von JP am 02.09.2016 16:04

Hi All

WB21 - Classic, Ajax enabled

I generate a page and I use CreateClone() to add additional images to the page as required. Each image control is given a unique name. The name contains a prefix which is a number like "01_ ... " , "02_ ..." , etc.

When the image is clicked I want to get this prefix number in the browser click code. But Myself..Name does not work. Myself..Name returns an internal WebDev control name like "A8". How can I get the controls name as I named it?




The browser code only get to know the ALIASES of the field names, as they are the ones known by an,d used in JS.

So either you do myself..name in SERVER CODE (in ajax mode, by example), or you base your code o nthe alaiases (they do not change, and are visible in the wwebdev editor in the field tooltip), or you set your project/page to use the regular names instead of the aliases in browser code.

If you use that last option, YOU will be responsible for using ONLY names that are JS compatible

Best regards

von Fabrice Harari - am 02.09.2016 17:59

Thanks very much. I shall investigate those options. In respect of the last option, "setting the page to use the regular names instead of the aliases" - what is the option for this, where do I find it?


von JP - am 02.09.2016 18:18
THis one is quite hidden

YOu have to go in the project description, advanced tab.
In there, at the top, you have the html standard combo. Immediately at its right you have a "..." button. Click it

In there you have 2 options: compact html and compact Javascript. It's one of the two.

As they change access and name for this option, and as I'm never using it, I can't tell you which one...

By the way, I just thought of yet another way of dealing with your situation.

You can get the alias of each field with the ..alias property. So if you compare with that, you are good to go.

Best regards

von Fabrice Harari - am 02.09.2016 18:38
Thanks Fabrice.

I looked at Alias but Myself..Name and Myself..Alias both return the same value of e.g. "A8" when used in Browser click code.

von JP - am 02.09.2016 18:49

So I found one solution which is this:

1) In Browser click code of the image get the given WebDev name of the control e.g. "A8".

2) Save this name to a hidden edit control

2) The click code then runs a Button Server click code

3) The button server click code then enumerates all the controls on the page looking for control..alias = WebDev control name

4) When found it can then retrieve the actual design time name using control..name since it is running in server code

Does this sound overly complex to you ?

von JP - am 02.09.2016 19:10
Does this sound overly complex to you ?


However, as you are not telling us what it is you are trying to achieve, in a general sense, I don't know how to give you a simpler method.

Best regards

von Fabrice Harari - am 03.09.2016 13:11
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.