Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 11 Monaten, 3 Wochen
Letzter Beitrag:
vor 11 Monaten, 3 Wochen
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?

Thanks

Antworten:

Hi JP

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
Fabrice,

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?

Thanks!

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
Fabrice,

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
Quote
JP
Does this sound overly complex to you ?


YES!

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.