Solved

setfocus using php codes

Posted on 2004-04-20
10
1,881 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
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 …

623 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