Solved

setfocus using php codes

Posted on 2004-04-20
10
1,867 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
designing in object programming 12 80
Testing a string condition in PHP 6 24
PHP and google maps 13 47
Cookie not unsetting 7 20
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
The viewer will learn how to dynamically set the form action using jQuery.
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 …

832 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