PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 2024 → How do I replicate this HTML code in WebDev?
How do I replicate this HTML code in WebDev?
Débuté par Steve Thompson, 04 nov. 2014 10:31 - 7 réponses
Posté le 04 novembre 2014 - 10:31
Hi,

How do I replicate this HTML code in WebDev? It's the oncliick / onfocus bit I'm struggling with.



<input type="text" value="Test1" onclick="this.select()" />


<input type="text" value="Test2" onfocus="this.select()" />


Thanks, Steve
Posté le 13 novembre 2014 - 12:46
Anyone???

Surely I can't be that difficult!
Posté le 13 novembre 2014 - 17:51
Hi Steve

not a lot of html developers here... So if you were instead to tell us
what you want to achieve in English, you may have more answers

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXReplication, your open source replication system is available on
my web site!!!
WXShowroom.com: Show your projects!
More information on http://www.fabriceharari.com


On 11/13/2014 6:46 AM, Steve Thompson wrote:
Anyone???

Surely I can't be that difficult!
Posté le 14 novembre 2014 - 10:15
Ok, sorry Fabrice,

When I click in a text field I'd like the current contents of the text field to be highlighted automatically so that any text input overwrites the current content.

Regards, Steve
Posté le 27 novembre 2014 - 10:31
Still no one knows?
Posté le 16 décembre 2014 - 21:20
Hi Steve,
Sorry for the late response,

Assuming you already have created the Edit control(textbox) with some prepopulated value.
I used a Page Level Javascript Browser Function, this function is simply:
FUNCTION selectField(id) {
var control = document.getElementById(id);
control.select();
}


In the WLanguage Click (onclick) put
selectField(MySelf..Alias)

Myself..Alias passes the html id to the javascript function.
FYI, WebDev alreayd does this natively when tabbing between controls. Put this code in the onclick function if you want to add the functionality when the user selects a field using their mouse.
Posté le 17 décembre 2014 - 14:06
This solution was implemented in WebDev 18. It should work in WebDev 19 and actually hopefully just putting
this.select();

as javascript into the onclick code.
Posté le 17 décembre 2014 - 16:58
Thanks Zach,

The first suggestion worked - the second didn't seem to...

Regards, Steve