Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Set focus to a button

Guest
Jul 19, 2009 Jul 19, 2009

Hi everyone,

I have been searching for a while without success so would like to ask if anyone can help me here.

I have a login page with jusy username and password text fields and a login button.

I would liek users to be able to hit the enter key to activate the login process.

My code currently is

<cfformgroup type="panel" label="Development Area" height="130" style="cornerRadius: 0;">
<cfinput type="text" name="username" width="150" label="Username">
<cfinput type="password" name="password" width="150" label="Password">
<cfformgroup type="horizontal">
<cfinput type="submit" name="login_user" height="22" width="150" value="Log In" style="#buttonStyle#">
</cfformgroup>
</cfformgroup>
</cfformgroup>

This works fine but only if the user uses the mouse to click the login button.

I think it is maybe something to do with "if key is 13 then do sonmething" but I can't seem to get the code right

Anyideas please??

Thanks in advance

TOPICS
Getting started
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 19, 2009 Jul 19, 2009

make it an html form.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 19, 2009 Jul 19, 2009

Don't suppose you have an example to share - sorry - am very new to all this and am really trying by myself but struggling....suppose we all start somewhere

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 19, 2009 Jul 19, 2009

<form action="somewhere" method="post">

<input type="text" name="username">

<input type="password" name="password">

<input type="submit" value="Keep it Simple">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 20, 2009 Jul 20, 2009
LATEST

Plz Try this..

<cfform

>

<cfformgroup type="panel" label="Development Area" height="130" style="cornerRadius: 0;"

>

<cfinput type="text" name="username" width="150" label="Username"

>

<cfinput type="password" name="password" width="150" label="Password"

>

<cfformgroup type="horizontal"

>

<cfinput type="submit" name="login_user" height="22" width="150" value="Log In" style="#buttonStyle#">

</cfformgroup>

</cfformgroup>

</cfform>

<cfif

Isdefined("login_user")>

<cfdump var="Do your action here">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources