Solved

setfocus using php codes

Posted on 2004-04-20
10
1,864 Views
Last Modified: 2013-12-12
hi,
hope you could help me this one:

in visual basic you can use setfocus by this code e.g text1.setfocus,   i just wanted to know what's the php version of this one?
and what is the php codes if you want message box will appear?

thanks....

0
Comment
Question by:joymavs
  • 5
  • 4
10 Comments
 
LVL 6

Expert Comment

by:CosminB
ID: 10875780
php for web or php-gtk?
if it's the first one you'll have to use javascript
if it's the second one you should use something like: $widget->grab_focus();
0
 

Author Comment

by:joymavs
ID: 10875933
hi cosminb,
i don't know much about java...
can you give me a sample of a javascript for setfocus..since it is php for web..

thanx....
0
 
LVL 6

Accepted Solution

by:
CosminB earned 50 total points
ID: 10876028
add this to your page(remember to modify the script):
<script language="JavaScript">
function putfocus()
{
   document.forms['form_name_goes_here'].elements['input_or_select_name_goes_here'].focus();
}
</script>

<body onload='putfocus()';>
0
 

Author Comment

by:joymavs
ID: 10876099
cosminb,

so there's no php code for setfocus?
and how to display the message box using php codes?

thanks...
0
 
LVL 6

Expert Comment

by:CosminB
ID: 10876417
no and what message box?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:joymavs
ID: 10876443
ok thanks...

what i mean about the message box is:

e.g. if you want to delete an entry, it will not delete automatically, we want that a message box will appear stating that "Are you sure you want to delete the entry?"...do you know how?

thanks again....
0
 
LVL 6

Expert Comment

by:CosminB
ID: 10876504
try this:
<a href="some_url_for_delete" onclick="return confirm('are you sure?')">
0
 

Author Comment

by:joymavs
ID: 10876531
we want a message box like in visual basic.....

where it will pop up...

is there a php version of it?

thanks...
0
 
LVL 1

Expert Comment

by:felixcattus
ID: 10878574
joymavs,

I don't think you're in the right place.  If you're talking about anything related to web developement, all these problems should be solved with Javascript, not PHP.  PHP is server side, what you are referring to is all on the browser (client) side.

Javascript allows you to accomplish features like setfocus and popup message boxes.  PHP doesn't deal with this.
(although technically, PHP can be used to dynamically generate the javascript code - which then accomplishes the features you are trying to accomplish).

Go to the Javascript section.

0
 

Author Comment

by:joymavs
ID: 10884520


thank you guys for your help......


joymavs
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now