I need to focus in a textbox from a embed code (group)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
rincon0204
- Posts: 5
- Joined: Thu May 28, 2015 3:40 pm
I need to focus in a textbox from a embed code (group)
Hi Friends!
I need your help in this point:
I made an app using the code provided on lessons¨runrev¨com/m/4069/l/22836-how-do-i-use-the-browser-control , 'drawing' a form made with HTML with some textboxes.
However, i need that when the app starts, it focuses in the first of these textboxes... (Obviously on the web, it works. But not in the app)
Which lines i need to put on the code of LiveCode, to achieve focusing in the textbox (on the group browser, which contains the HTML content)?
I would thank your help.
Greetings!
I need your help in this point:
I made an app using the code provided on lessons¨runrev¨com/m/4069/l/22836-how-do-i-use-the-browser-control , 'drawing' a form made with HTML with some textboxes.
However, i need that when the app starts, it focuses in the first of these textboxes... (Obviously on the web, it works. But not in the app)
Which lines i need to put on the code of LiveCode, to achieve focusing in the textbox (on the group browser, which contains the HTML content)?
I would thank your help.
Greetings!
Re: I need to focus in a textbox from a embed code (group)
Hi rincon, a piece of advice would be to first consult the dictionary and then the forum, most of the times you easily first the answers there.
OR
Where fieldName is the name of your field.
Code: Select all
focus on field 1Code: Select all
focus on field "fieldName"Knowledge is meant to be shared.
Re: I need to focus in a textbox from a embed code (group)
forgot to mention you have to add this code at you openStack handler, so the result would be:
Put this code in your stack.
Code: Select all
on openStack
focus on field "myField"
end openStackKnowledge is meant to be shared.
Re: I need to focus in a textbox from a embed code (group)
Hi zaxos,
the TS is not talking about Livecode fields, but a "field" inside of the HTML/webpage in a browser!
Best
Klaus
the TS is not talking about Livecode fields, but a "field" inside of the HTML/webpage in a browser!
Best
Klaus
-
rincon0204
- Posts: 5
- Joined: Thu May 28, 2015 3:40 pm
Re: I need to focus in a textbox from a embed code (group)
Exactly, as Klaus says...
The focus must be on the webpage (exactly on the textbox), the focus isn't in a text control from LiveCode.
It's not enough with putting on the HTML code:
window.document.form1.name.focus();
when in the app this line doesn't have the same effect as on the web.
The focus must be on the webpage (exactly on the textbox), the focus isn't in a text control from LiveCode.
It's not enough with putting on the HTML code:
window.document.form1.name.focus();
when in the app this line doesn't have the same effect as on the web.
Last edited by rincon0204 on Tue Jun 02, 2015 5:57 pm, edited 2 times in total.
Re: I need to focus in a textbox from a embed code (group)
How did i miss that
Thanks for pointing out Klaus, i'l delete the posts
nvm, cant delete them.
Thanks for pointing out Klaus, i'l delete the posts
nvm, cant delete them.
Knowledge is meant to be shared.
Re: I need to focus in a textbox from a embed code (group)
As for rincons problem, well i dont think livecode has a function to do that, but my guess is that you could use a simple js code to achive it:
Where myField is your input's name.
My guess is that js wont work with revBrowserOpen as i had problems in the past, so use revBrowserOpenCef instead.
EDIT: Just tested it on windows and works as expected...
Code: Select all
<script>
window.onload = function() {
document.getElementById("myField").focus();
};
</script>My guess is that js wont work with revBrowserOpen as i had problems in the past, so use revBrowserOpenCef instead.
EDIT: Just tested it on windows and works as expected...
Knowledge is meant to be shared.