Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1892
  • Last Modified:

setfocus using php codes

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
joymavs
Asked:
joymavs
  • 5
  • 4
1 Solution
 
CosminBCommented:
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
 
joymavsAuthor Commented:
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
 
CosminBCommented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
joymavsAuthor Commented:
cosminb,

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

thanks...
0
 
CosminBCommented:
no and what message box?
0
 
joymavsAuthor Commented:
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
 
CosminBCommented:
try this:
<a href="some_url_for_delete" onclick="return confirm('are you sure?')">
0
 
joymavsAuthor Commented:
we want a message box like in visual basic.....

where it will pop up...

is there a php version of it?

thanks...
0
 
felixcattusCommented:
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
 
joymavsAuthor Commented:


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


joymavs
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now