PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WB21] - CreateClone
[WB21] - CreateClone
Iniciado por guest, 02,sep. 2016 18:04 - 6 respuestas
Publicado el 02,septiembre 2016 - 18: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
Publicado el 02,septiembre 2016 - 19:59
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
Publicado el 02,septiembre 2016 - 20:18
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!
Publicado el 02,septiembre 2016 - 20:38
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
Publicado el 02,septiembre 2016 - 20:49
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.
Publicado el 02,septiembre 2016 - 21:10
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 ?
Publicado el 03,septiembre 2016 - 15:11
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