Solved

setfocus using php codes

Posted on 2004-04-20
10
1,879 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
Industry Leaders: 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

Suggested Solutions

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

739 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