Search This Blog

Friday, October 25, 2013

Windows 8 shortcut keys

Windows 8


Description Keys
Open the Charms WINKEY KEY+C
Open the Share charm WINKEY KEY+H
Open the Devices charm WINKEY KEY+K
Open the Settings charm WINKEY KEY+I
Open the Search charm to search files WINKEY KEY+F
Zoom in or out of apps pinned to the Start screen CTRL+PLUS OR CTRL+MINUS OR CTRL+SCROLL WHEEL
Open the commands for the app WINKEY KEY+C
Switch the main app and snapped app WINKEY KEY+J
Lock the device orientation WINKEY KEY+O
Open the Search charm to search apps WINKEY KEY+Q
Loop through notifications WINKEY KEY+V
Loop through notifications in reverse order WINKEY KEY+SHIFT+V
Open the Search charm to search settings WINKEY KEY+W
Temporarily peek at the desktop WINKEY KEY+,
Show the commands available in the app WINKEY KEY+Z
Switch input language and keyboard layout WINKEY KEY+SPACEBAR
Change to a previously selected input WINKEY KEY+CTRL+SPACEBAR
Loop through open apps (except desktop apps) WINKEY KEY+TAB
Loop through open apps (except desktop apps) and snaps them as they are cycled WINKEY KEY+CTRL+TAB
Loop through open apps (except desktop apps) in reverse order WINKEY KEY+SHIFT+TAB
Move the Start screen and apps to the monitor on the left (Apps in the desktop won’t change monitors) WINKEY KEY+PGUP
Move the Start screen and apps to the monitor on the right (Apps in the desktop won’t change monitors) WINKEY KEY+PGDOWN
Snaps an app to the left WINKEY KEY+SHIFT+PERIOD (.)
Snaps an app to the right
Key TK8TP PJN6P 7X7WW RFFTV 87QPF
refresh F5
bbrown@gosafeguard CTRL+E

bbrown@gosafeguard.com CTRL+E

close app ALT+W
grapics view WINKEY+TAB

Basic


Description Keys
Display Help F1
Rename F2
Search F3

Show address bar in Explorer F4

Refresh F5

Loop through screen elements in a window or on the desktop F6

Activate the menu bar in the active app F10

Close the active item, or exit the active app ALT+F4

Loop through items in the order in which they were opened ALT+ESC

Perform the command for that letter ALT+UNDERLINED LETTER

Display properties for the selected item ALT+ENTER

Open the shortcut menu for the active window ALT+SPACEBAR

Back ALT+LEFT ARROW

Forward ALT+RIGHT ARROW

Move up one screen ALT+PAGE UP

Move down one screen ALT+PAGE DOWN

Switch between open apps (except desktop apps) ALT+TAB

Close the active document (in apps that allow you to have multiple documents open simultaneously) CTRL+F4

Select all items in a document or window CTRL+A

Copy the selected item CTRL+C (OR CTRL+INSERT)

Refresh the active window CTRL+R (OR F5)

Paste the selected item CTRL+V (OR SHIFT+INSERT)

Cut the selected item CTRL+X

Undo an action CTRL+Z

Redo an action CTRL+Y

Zoom in or out of apps pinned to the Start screen CTRL+PLUS (+) OR CTRL+MINUS (-)

Zoom in or out of apps pinned to the Start screen CTRL+SCROLL WHEEL

Change the size of desktop icons CTRL+ MOUSE SCROLL WHEEL

Move the cursor to the beginning of the next word CTRL+RIGHT ARROW

Move the cursor to the beginning of the previous word CTRL+LEFT ARROW

Move the cursor to the beginning of the next paragraph CTRL+DOWN ARROW

Move the cursor to the beginning of the previous paragraph CTRL+UP ARROW

Use the arrow keys to switch between all open apps CTRL+ALT+TAB

Select multiple individual items in a window or on the desktop CTRL WITH AN ARROW KEY+SPACEBAR

Select a block of text CTRL+SHIFT WITH AN ARROW KEY

Open the Start screen CTRL+ESC

Open Task Manager CTRL+SHIFT+ESC

Switch the keyboard layout when multiple keyboard layouts are enabled CTRL+SHIFT

Display the shortcut menu for the selected item SHIFT+F10

Select more than one item in a window or on the desktop, or select text within a document SHIFT WITH ANY ARROW KEY

Delete the selected item without moving it to the Recycle Bin first SHIFT+DELETE

Open the next menu to the right, or open a submenu RIGHT ARROW

Open the next menu to the left, or close a submenu LEFT ARROW

Cancel the current task ESC

Dialogs


Description Keys

Display Help F1

Display the items in the active list F4

Move forward through tabs CTRL+TAB

Move back through tabs CTRL+SHIFT+TAB

Move to Nth tab CTRL+N (NUMBER 1-9)

Move forward through options TAB

Move back through options SHIFT+TAB

Perform the command or select the option for that letter ALT+UNDERLINED LETTER

Replace clicking the mouse for many selected commands ENTER

Select or clear the check box if the active option is a check box SPACEBAR

Open a folder one level up if a folder is selected in the Save As or Open dialog box BACKSPACE

Select a button if the active option is a group of option buttons ARROW KEYS

Windows logo


Description Keys

Windows key keyboard shortcuts

Open Windows Help and Support WINKEY KEY+F1

Display or hide the Start menu WINKEY KEY

Set focus in the notification area WINKEY KEY+B

Open the Charms WINKEY KEY+C

Open the commands for the app WINKEY KEY+C

Display and hides the desktop WINKEY KEY+D

Open Computer WINKEY KEY+E

Open the Search charm and search file WINKEY KEY+F

Cycle through gadgets on the desktop WINKEY KEY+G

Open the Share charm WINKEY KEY+H

Open the Settings charm WINKEY KEY+I

Switch the main app and snapped app WINKEY KEY+J

Open the Devices charm WINKEY KEY+K

Lock your PC or switch users WINKEY KEY+L

Minimize all windows WINKEY KEY+M

Lock device orientation WINKEY KEY+O

Choose a presentation display mode WINKEY KEY+P

Open the Search charm and search apps WINKEY KEY+Q

Open the Run dialog box WINKEY KEY+R

Cycle through apps on the taskbar WINKEY KEY+T

Open Ease of Access Center WINKEY KEY+U

Cycle through notifications WINKEY KEY+V

Cycle through notifications in reverse order WINKEY KEY+SHIFT+V

Open the Search charm and search settings WINKEY KEY+W

Opens the Quick Link menu WINKEY KEY+X

Temporarily peek at the desktop WINKEY KEY+,

Show the commands available in the app WINKEY KEY+Z

Display the System Properties dialog box WINKEY KEY+PAUSE

Search for PCs (if you're on a network) WINKEY KEY+CTRL+F

Restore minimized windows on the desktop WINKEY KEY+SHIFT+M

Start the desktop app pinned to the taskbar in the position indicated by the number. If the app is already running, switch to that app. WINKEY KEY+NUMBER

Start a new instance of the desktop app pinned to the taskbar in the position indicated by the number WINKEY KEY+SHIFT+NUMBER

Switch to the last active window of the desktop app pinned to the taskbar in the position indicated by the number WINKEY KEY+CTRL+NUMBER

Open the Jump List for the desktop app pinned to the taskbar in the position indicated by the number WINKEY KEY+ALT+NUMBER

Open a new instance of the desktop app located at the given position on the taskbar as admin WINKEY KEY+CTRL+SHIFT+NUMBER

Cycle through open apps (except desktop apps) WINKEY KEY+TAB

Cycle through open apps (except desktop apps) and snaps them as they are cycled WINKEY KEY+CTRL+TAB

Switch to the app that displayed a message in the notification area WINKEY KEY+CTRL+B

Maximize the desktop window WINKEY KEY+UP ARROW

Minimize the desktop window

Maximize the desktop window to the left side of the screen WINKEY KEY+LEFT ARROW

Maximize the desktop window to the right side of the screen WINKEY KEY+RIGHT ARROW

Minimize all but the active desktop window (restores all windows on second stroke) WINKEY KEY+HOME

Stretch the desktop window to the top and bottom of the screen WINKEY KEY+SHIFT+UP ARROW

Restore/minimize active desktop windows vertically, maintaining width WINKEY KEY+SHIFT+DOWN ARROW

Move a window in the desktop from one monitor to another WINKEY KEY+SHIFT+LEFT ARROW OR RIGHT ARROW

Switch input language and keyboard layout WINKEY KEY+SPACEBAR

Change to a previously selected input WINKEY KEY+CTRL+SPACEBAR

Open Narrator WINKEY KEY+ENTER

Move the Start screen and apps to the monitor on the left (Apps in the desktop won’t change monitors) WINKEY KEY+PGUP

Move the Start screen and apps to the monitor on the right (Apps in the desktop won’t change monitors) WINKEY KEY+PGDOWN

Snaps an app to the left WINKEY KEY+SHIFT+PERIOD (.)

Snaps an app to the right WINKEY KEY+PERIOD (.)

Cycle through opens apps (except desktop apps) WINKEY KEY+TAB

Cycle through opens apps (except desktop apps) in reverse order

Cycle through opens apps (except desktop apps) and snaps them as they are cycled WINKEY KEY+CTRL+TAB

Initiate IME reconversion WINKEY KEY+/

Opens Windows Media Center WINKEY KEY+ALT+ENTER

Zoom in or out (in Magnifier) WINKEY KEY+PLUS (+) OR MINUS (-)

Exit Magnifier WINKEY KEY+ESC

Explorer


Description Keys

Select the address bar ALT+D

Select the search box CTRL+E

Select the search box CTRL+F

Open a new window CTRL+N

Close the current window CTRL+W

Change the size and appearance of file and folder icons CTRL+MOUSE SCROLL WHEEL

Display all folders above the selected folder CTRL+SHIFT+E

Create a new folder CTRL+SHIFT+N

Display all subfolders under the selected folder NUM LOCK+ASTERISK (*)

Display the contents of the selected folder NUM LOCK+PLUS (+)

Collapse the selected folder NUM LOCK+MINUS (-)

Display the preview pane ALT+P

Open the Properties dialog box for the selected item ALT+ENTER

View the next folder ALT+RIGHT ARROW

View the parent folder ALT+UP ARROW

View the previous folder ALT+LEFT ARROW

View the previous folder BACKSPACE

Display the current selection (if it's collapsed), or select the first subfolder RIGHT ARROW

Collapse the current selection (if it's expanded), or select the parent folder LEFT ARROW

Display the bottom of the active window END

Display the top of the active window HOME

Maximize or minimize the active window F11

Taskbar


Description Keys

Open a app or quickly open another instance of a app SHIFT+CLICK ON A TASKBAR BUTTON

Open a app as an administrator CTRL+SHIFT+CLICK ON A TASKBAR BUTTON

Show the window menu for the app SHIFT+RIGHT-CLICK ON A TASKBAR BUTTON

Show the window menu for the group SHIFT+RIGHT-CLICK ON A GROUPED TASKBAR BUTTON


Ease of Access


Description Keys

Turn Filter Keys on and off RIGHT SHIFT FOR EIGHT SECONDS

Turn High Contrast on or off LEFT ALT+LEFT SHIFT+PRTSCN

Turn Mouse Keys on or off LEFT ALT+LEFT SHIFT+NUM LOCK

Turn Sticky Keys on or off SHIFT FIVE TIMES

Turn Toggle Keys on or off NUM LOCK FOR FIVE SECONDS

Open the Ease of Access Center WINKEY KEY+U

Magnifier


Description Keys

Zoom in or out WINKEY KEY+PLUS (+) OR MINUS (-)

Preview the desktop in full-screen mode

Switch to docked mode CTRL+ALT+D

Switch to full-screen mode CTRL+ALT+F

Invert colors CTRL+ALT+I

Switch to lens mode CTRL+ALT+L

Resize the lens CTRL+ALT+R

Pan in the direction of the arrow keys

Exit Magnifier WINKEY KEY+ESC

Remote Desktop


Description Keys

Move between apps from left to right ALT+PAGE UP

Move between apps from right to left ALT+PAGE DOWN

Cycle through apps in the order that they were started in ALT+INSERT

Display the Start menu ALT+HOME

Switch between a window and full screen CTRL+ALT+BREAK

Display the Windows Security dialog box CTRL+ALT+END

Display the system menu ALT+DELETE

Place a copy of the active window, within the client, on the Terminal server clipboard (provides the same functionality as pressing Alt+PrtScn on a local PC). CTRL+ALT+MINUS (-) ON THE NUMERIC KEYPAD

Place a copy of the entire client window area on the Terminal server clipboard (provides the same functionality as pressing PrtScn on a local PC). CTRL+ALT+PLUS (+) ON THE NUMERIC KEYPAD

“Tab” out of the Remote Desktop controls to a control in the host app (for example, a button or a text box). Useful when the Remote Desktop controls are embedded in another (host) app. CTRL+ALT+RIGHT ARROW

“Tab” out of the Remote Desktop controls to a control in the host app (for example, a button or a text box). Useful when the Remote Desktop controls are embedded in another (host) app. CTRL+ALT+LEFT ARROW
Continue Reading...

Wednesday, October 23, 2013

Android Secret codes

1. Phone Information, Usage andBattery ? *#*#4636#*#*

2. IMEI Number ? *#06#

3. Enter Service Menu On NewerPhones ? *#0*#

4. Detailed Camera Information ?*#*#34971539#*#*

5. Backup All Media Files ?*#*#273282*255*663282*#*#*

6. Wireless LAN Test ?*#*#232339#*#*

7. Enable Test Mode for Service ?*#*#197328640#*#*

8. Back-light Test ? *#*#0842#*#*

9. Test the Touchscreen ?*#*#2664#*#*

10. Vibration Test ? *#*#0842#*#*

11. FTA Software Version ?*#*#1111#*#*

12. Complete Software andHardware Info ? *#12580*369#

13. Diagnostic Configuration ?*#9090#

14. USB Logging Control ?*#872564#

15. System Dump Mode ? *#9900#

16. HSDPA/HSUPA Control Menu ?*#301279#

17. View Phone Lock Status ?*#7465625#

18. Reset the Data Partition toFactory State ? *#*#7780#*#*
Continue Reading...

Sunday, October 20, 2013

Deleting Multiple Records using PHP and jQuery

Some of web applications, there have a single of deleting of record, what if there have a many record? In this tutorial we will show you, using PHP and jQuery to develop a simple web application a function can able to multiple delete records, using check box.

Step 1: Setting up the database

First thing to do we need some data, go your to your phpMyAdmin create a database let say your database name is ‘multiple_delete’, after creating the database create a table let say your table name is ‘products’ and we add the following fields to the table.
  • id
  • product_title
  • product_price
After creating the table ‘products’, insert some of sample products.
INSERT INTO products (product_title, product_price) VALUES
('iphone 4s 16GB', '$500'),
('Playstation 3 120GB', '$200'),
('Nintendo Wii', '$190'),
('Nintendo 3DS', '$50'),
('Mac Book', '$800'),
('Ipod 3', '$700'),
('Ipod 2', '$300'),
('Iphone 4', '$300'),
('Mp3 Player', '$20'),
('GPS', '$350');

Step 2: Create Database Connection

We have our product sample from the database, so we need to connect from database. Create a file named ‘database.php’, and input the following code.
database.php
<?php
$db = mysql_connect("localhost", "root", ""); // your host, user, password
 if(!$db) { echo mysql_error(); }
 $select_db = mysql_select_db("multiple_delete"); // database name
 if(!$select_db) { echo mysql_error(); }
?>
We have assigning the database credentials. the MySQL host, username, password and database name.

Step 3: Displaying the Product from the Database

To grab the data from the database, create file name index.php, our home page, and input the following code snippet.
index.php
<?php
 require_once("database.php"); // 1. require the database file
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Deleting Multiple Records using PHP and jQuery | iStockphp.com</title>
<link href="style/style.css" rel="stylesheet" type="text/css" media="all" /> <!--- include the css file -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script> <!--- include the live jquery library -->
<script type="text/javascript" src="js/script.js"></script> <!--- include the our jquery file  -->
</head>

<body>
 <div id="wrap" align="center"> <!--wrap start-->
     <h1>Deleting Multiple Records using PHP and jQuery</h1>
         <form action="delete.php" method="post" name="data_table">
        <table id="table_data">

         <tr>
             <td>id</td>
             <td>Product name</td>
                <td>Price</td>
                <td>Check All <input type="checkbox" id="check_all" value=""></td>
            </tr>
            <?php
    $query = mysql_query("SELECT `id`, `product_title`, `product_price` FROM `products`"); // 2. perform a query
    while($row = mysql_fetch_array($query)) {
   ?>
            <tr>
             <td><?php echo $row['id']; ?></td>
             <td><?php echo $row['product_title']; ?></td>
                <td><?php echo $row['product_price']; ?></td>
                <td><input type="checkbox" value="<?php echo $row['id']; ?>" name="data[]" id="data"></td>
            </tr>
            <?php
    } unset($row); // unset the query after perform
   ?>

        </table>
        <br />
        <input name="submit" type="submit" value="Delete" id="submit">
       </form>
  </div> <!--wrap end-->
</body>
</html>
We require the ‘database.php’ for our database connection, and perform a simple query to fetch the data, and also we need to include the CSS for simple style and jQuery live script and jQuery script.
style.css
body {
 background: url(../images/bg.jpg);
 font-family: Arial, Helvetica, sans-serif;
 font-size:13px
}
h1 {
 color:#000000;
 font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
}
p {
 margin:10px;
 padding:10px;
 color:#000000;
}
table#table_data {
    border: 1px solid #CCCCCC;
    width: 485px;
}
table#table_data tr:first-child {
 font-weight:bold;
 text-transform:uppercase
}
table#table_data tr td {
    border: 1px solid #CCCCCC;
 text-align:center

}
table#table_data tr:first-child {
 text-align:center;
 border:1px solid #999

}

Step 4: Creating the jQuery Script

We create the jQuery script to triggered the all check boxes in the form, create file name ‘script.js’ and input the code snippet below.
script.js
jQuery(function($) {
 $("form input[id='check_all']").click(function() { // triggred check

  var inputs = $("form input[type='checkbox']"); // get the checkbox

  for(var i = 0; i < inputs.length; i++) { // count input tag in the form
   var type = inputs[i].getAttribute("type"); //  get the type attribute
    if(type == "checkbox") {
     if(this.checked) {
      inputs[i].checked = true; // checked
     } else {
      inputs[i].checked = false; // unchecked
       }
    }
  }
 });

 $("form input[id='submit']").click(function() {  // triggred submit

  var count_checked = $("[name='data[]']:checked").length; // count the checked
  if(count_checked == 0) {
   alert("Please select a product(s) to delete.");
   return false;
  }
  if(count_checked == 1) {
   return confirm("Are you sure you want to delete these product?");
  } else {
   return confirm("Are you sure you want to delete these products?");
    }
 });
}); // jquery end

Step 5: The Deleting Process

After posting the data in the form action attribute, we create the PHP script to catch the post data and process the deleting script. Create the file name ‘delete.php’ and input the code snippet below.
delete.php
<?php
require_once("database.php");
if(isset($_POST['submit'])) {
 $id_array = $_POST['data']; // return array
 $id_count = count($_POST['data']); // count array

 for($i=0; $i < $id_count; $i++) {
  $id = $id_array[$i];
  $query = mysql_query("DELETE FROM `products` WHERE `id` = '$id'");
  if(!$query) { die(mysql_error()); }
 }
 header("Location: index.php"); // redirent after deleting
}
?>

Step 5: Complete

And now were done we creating the dynamic deleting multiple records using PHP and jQuery. Let’s have a look at what we’ve achieved:
  • We’ve set up a database, table and products for our data.
  • We’ve create a simple form to retrieve the data
  • We’ve create the jQuery script to triggered the check boxes.
  • We’ve create the deleting process to delete the post data array.   

Continue Reading...

CREATING A SIMPLE TAB WITH JQUERY

Step 1: Creating the Page Template
In the index.html, we have a tab header block and tab contents block, in the li tags with the attribute of id tabHeader_1, tabHeader_2 tabHeader_3 Which holds the trigger of jQuery onclick event, and the contents block are display in to block, the li id tabHeader_1 we set to active for the default active tab.
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Creating a Simple Tab with jQuery | istockphp.com</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>
<script type="text/javascript" src="script.js"> </script>
</head>
<body>

<div id="wrapper"> <!--wrapper start-->
	<div id="tabContainer"> <!--tabContainer start-->

		<div class="tabs">
		  <ul>
			<li id="tabHeader_1" class="active_tab">Tab 1</li>
			<li id="tabHeader_2">Tab 2</li>
			<li id="tabHeader_3">Register</li>
		  </ul>
		</div> <!--tabs end-->

		<div class="tabscontent">
		  <div class="tabpage" id="tabpage_1">
			<h2>Tab 1</h2>
			<p>
            	Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
                Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.
                Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
                Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
                Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.
                Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
            </p>
		  </div>
		  <div class="tabpage" id="tabpage_2">
			<h2>Tab 2</h2>
			<p>
            	Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
                Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.
                Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
            </p>
		  </div>
		  <div class="tabpage" id="tabpage_3">
			<h2>Register</h2>
				<form>
                	<p><label>Name</label> <input name="name" type="text" size="25" /></p>
                    <p><label>Password</label> <input name="password" type="password" size="25" /></p>
                    <p><label>Re Password</label> <input name="repassword" type="password" size="25" /></p>
                    								<p><input name="submit" type="button" value="Submit"/></p>
                </form>
			</div>
		</div> <!--tabscontent end-->

	</div> <!--tabContainer end-->
</div> <!--wrapper end-->
</body>
</html>
In css in line 45 we set the first tab to active and line 56 we set the first tab page to block.
style.css
body {
	background: #CCC;
	font-size: 14px;
	font-family:Arial, Helvetica, sans-serif;
	padding:0;
	margin:0
}
h2{
	margin-bottom:10px;
}
div#wrapper{
	width:720px;
	margin:40px auto 0;
}
div#tabContainer {
	width:700px;
	padding:15px;
	background-color:#2e2e2e;
	border-radius: 4px;
}
div.tabs {
    height: 36px;
}
div.tabs ul {
    font-size: 18px;
    list-style: none outside none;
	margin:0;
	padding:0
}

div.tabs ul li {
    background: none repeat scroll 0 0 #666666;
    border-radius: 8px 8px 0 0;
    color: #FFFFFF;
    display: block;
    float: left;
    margin: 0 2px 0 0;
    padding: 7px 10px;
}
div.tabs ul li:hover{
	background: #FFFFFF;
	cursor:pointer;
	color: #333;
}
div.tabs ul li.active_tab {
	background: #FFFFFF;
	cursor:pointer;
	color: #333;
}
.tabscontent {
	padding:10px 10px 25px;
	background: #FFFFFF; /* old browsers */
	margin:0;
	color:#333;
}
div.tabpage:first-child {
	display:block
}
div.tabpage {
	display:none
}
form label {
    display: block;
    float: left;
    width: 90px;
}

Step 2: jQuery Script

In the script, we count the the li element tabHeader and loop, and every click the li element we apply the jQuery remove class and add class, to remove the active elements in first load of the page and add class it self.
script.js
/* http://istockphp.com */
$(function() {
	var tabs = $('div.tabs ul li').length;	// count the tab

	for(var i = 0; i  < tabs + 1; i++) {
		$('li#tabHeader_'+ i ).click(function() {

			$('li.active_tab').removeClass('active_tab');	// remove class
			$(this).addClass('active_tab'); // addClass to tab

			var tab_id = $(this).attr('id'); // return: tabHeader_1

			var id = tab_id.split("_")[1]; //

			var tabpage_id = $('div#tabpage_'+id).attr('id'); // return: tabpage_1
			var get_id = tabpage_id.split("_")[1]; // return: 1

			$('div.tabpage').css('display', 'none');
			$('div.tabscontent div#tabpage_'+ get_id).css('display', 'block');

			//if(tabpage_id == 'tabpage_3'){
				// ajax here, if the data from database
			//}
		});
	}
});

Step 3: Done

And now we created hard coded simple tab with jQuery, without using the third party plugins, and we sure this tabs are tested all modern browser and internet explorer 7 and 8, Let’s have a look at what we’ve achieved:
  • We set the template with default view.
  • We creating the tab without using third party plugin tab.
  • Tested all modern browsers, including IE 7 and 8

Continue Reading...

JQUERY SIMPLE VALIDATION IN REGISTRATION FORM

Jquery validation in the web form is extremely important in our web development, we need to learn jquery for validating the form such as online registration form, contact form or any web form design in our site for preventing human errors, malicious value’s and make valid value before inserting in the database. In reality validating forms is very easy, there have many jQuery third party plugin out there and ready to use.
But If you wonder on how validate forms your own hand, In this jquery example i would like to share our simple form validation using jQuery library.
In this tutorial we create a simple form validation jquery that have most use input fields, like in real world online registration form and also we create the dynamic date using php loop and after fill in up the form jQuery will validate the valid values after the value is valid it will pass to php file, so let’s begin.

1. Creating the Page Template

index.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Simple Validation in Registration Form | istockphp.com</title>
<link href="style/style.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery-1.9.1.js"> </script>
<script type="text/javascript" src="js/script.js"></script>
</head>

<body>
	<div id="wrap"> <!--wrap start-->
    	<div id="wrap2">  <!--wrap2 start-->

       	<h2 class="free_account">Create an free account</h2>

    	<form action="process.php" method="post" id="register_form">

                <p class="validate_msg">Please fix the errors below!</p>

                <p> <label for="name">First Name</label> <input name="fname" type="text" /> <span class="val_fname"></span> </p>
                <p> <label for="lname">Last Name</label>  <input name="lname" type="text" />  <span class="val_lname"></span> </p>
                <p> <label for="email">Your Email</label> <input name="email" type="text" /> <span class="val_email"></span> </p>
                <p> <label for="password">Password</label>  <input name="password" type="password" /> <span class="val_pass"></span> </p>
                <p> <label for="repassword">Retype Password</label>  <input name="repassword" type="password" /> <span class="val_pass2"></span> </p>
                <p> <label for="phone">Phone No.</label> <input name="phone" type="text" /> <span class="val_phone"></span> </p>
                <p> <label for="birth">Birth Date</label>
                            	<select name="month">
                    				<option value="">Month</option>
                                    <?php
										$months = array('1' => 'Jan', '2' => 'Feb', '3' => 'Mar', '4' => 'Apr', '5' => 'May', '6' => 'June', '7' => 'July ', '8' => 'Aug', '9' => 'Sept', '10' => 'Oct', '11' => 'Nov', '12' => 'Dec');
										foreach($months as $m => $month) {
									?>
                                    <option value="<?php echo $m; ?>"><?php echo $month; ?></option>
                                    <?php } ?>
                                </select>
                                <select name="day">
                    				<option value="">Day</option>
                                    <?php for($day = 1; $day < 32; $day++) { ?>
                                    <option value="<?php echo $day; ?>"><?php echo $day; ?></option>
                                    <?php } ?>
                                </select>
                                <select name="year">
                    				<option value="">Year</option>
                                    <?php
										$year = date("Y");
										for($j = $year; $j > 1949; $j--) {
									?>
                                    <option value="<?php echo $j; ?>"><?php echo $j; ?></option>
                                    <?php } ?>
                                </select>
                <span class="val_bday"></span> </p>
                <p> <label for="gender">Gender</label>  <input name="gender" type="radio" value="m" /> Male <input name="gender" type="radio" value="f" /> Female <span class="val_gen"></span> </p>
            <input type="submit" name="submit" value="Register">
        </form>

        </div>  <!--wrap2 end-->
    </div>  <!--wrap start-->
</body>
</html>
In the index.php file we used the most common input field in web such as input fields, drop down and radio buttons. In the birthday field we turn it into the dynamic loop, for the month we use foreach loop to generate dynamic months and the days we loop 1-32 and the year we decrement the year 1949.

2. The stylesheet

style.css
body {
	font-family: sans-serif;
	font-size:13px;
	background:#CCCCCC;
	color:#444444;
}
p {
	padding:2px
}
#wrap {
	width:820px;
	padding:20px;
	margin:20px auto;
	background:#fff;
	border:1px solid #cc;
	-moz-border-radius:10px;
	-webkit-border-radius:10px;
}
div#wrap2 {
    border: 1px solid #CCCCCC;
    margin-bottom: 10px;
    padding:15px;
}
h2.free_account {
    color: #3399FF;
    display: block;
    margin-bottom: 25px;
}
form#register_form label {
	display:inline-block; /* with block na */
	width:125px;
	font-weight:bold;
}
form#register_form label:after {
	content:":"
}
form#register_form input[type='text'], input[type='password'] {
	display:inline-block; /* with block na */
	width:200px;
	border:1px solid #ccc;
	margin:0;
	padding:5px;
}
form#register_form select {
    border: 1px solid #CCCCCC;
    display: inline-block;
    margin: 0;
    padding: 5px 0;
    width: 68px;
}
form#register_form input[name='submit'] {
	border:1px solid #3399FF;
	background:#3399FF;
	border-radius: 5px;
	margin:10px;
	color:#FFF;
	padding:5px;
	font-weight:bold
}
form#register_form input[name='submit'] {
	cursor:pointer;
}
p.validate_msg {
    border: 1px solid #FF0000;
    font-weight: bold;
    padding: 10px;
	display:none;
	margin-bottom:25px
}
span.validate  {
	color:#F00;
	padding-left:8px;
	font-style:italic;
}
Our simple style

3. The jQuery script

script.js
jQuery(function($) {
	var validation_holder;

	$("form#register_form input[name='submit']").click(function() {

	var validation_holder = 0;

		var fname 			= $("form#register_form input[name='fname']").val();
		var lname 			= $("form#register_form input[name='lname']").val();
		var email 			= $("form#register_form input[name='email']").val();
		var email_regex 	= /^[\w%_\-.\d]+@[\w.\-]+.[A-Za-z]{2,6}$/; // reg ex email check
		var password 		= $("form#register_form input[name='password']").val();
		var repassword 		= $("form#register_form input[name='repassword']").val();
		var phone 			= $("form#register_form input[name='phone']").val();
		var phone_regex		= /^[0-9]{4,20}$/; // reg ex phone check
		var month 			= $("form#register_form select[name='month']").val(); // month
		var day 			= $("form#register_form select[name='day']").val(); // day
		var year 			= $("form#register_form select[name='year']").val(); // year
		var gender 			= $("form#register_form input[name='gender']");

		/* validation start */
		if(fname == "") {
			$("span.val_fname").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
			$("span.val_fname").html("");
			}
		if(lname == "") {
			$("span.val_lname").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
			$("span.val_lname").html("");
			}
		if(email == "") {
			$("span.val_email").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
			if(!email_regex.test(email)){ // if invalid email
				$("span.val_email").html("Invalid Email!").addClass('validate');
				validation_holder = 1;
			} else {
				$("span.val_email").html("");
			}
		}
		if(password == "") {
			$("span.val_pass").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
				$("span.val_pass").html("");
			}
		if(repassword == "") {
			$("span.val_pass2").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
			if(password != repassword) {
				$("span.val_pass2").html("Password does not match!").addClass('validate');
				validation_holder = 1;
			} else {
				$("span.val_pass2").html("");
			}
		}
		if(phone == "") {
			$("span.val_phone").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
			if(!phone_regex.test(phone)){ // if invalid phone
				$("span.val_phone").html("Invalid Phone Number!").addClass('validate');
				validation_holder = 1;

			} else {
				$("span.val_phone").html("");
			}
		}
		if((month == "") || (day == "") || (year == "")) {
			$("span.val_bday").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
				$("span.val_bday").html("");
			}

		if(gender.is(':checked') == false) {
			$("span.val_gen").html("This field is required.").addClass('validate');
			validation_holder = 1;
		} else {
				$("span.val_gen").html("");
			}
		if(validation_holder == 1) { // if have a field is blank, return false
			$("p.validate_msg").slideDown("fast");
			return false;
		}  validation_holder = 0; // else return true
		/* validation end */
	}); // click end

}); // jQuery End
In the script.js file, we set variable validation_holder with default value 0, these control the validating values, in the line 8-19 we getting the value in the fields as we validate email viaRegular Expression. The validation process start in line 22, so the common logic is if the value is equal to blank the validation_holder set to 1 and return false else return true thevalidation_holder set to 0.

4. Process Data

process.php
<?php
// author: http://istockphp.com
$fname 		= trim($_POST['fname']); // trim remove white space
$lname 		= trim($_POST['lname']);
$email 		= trim($_POST['email']);
$password 	= trim($_POST['password']);
$phone 		= trim($_POST['phone']);
$birth 		= $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];
$gender 	= $_POST['gender'];
// do something. mysql_query
//header("Location: index.php");
//exit();
?>
This process.php file getting the values of the form after they validated, so we use the trimfunction to remove while space if any, then you can do mysql insert and after inserted the data, redirect to the success page.

5. Done

We’re done, we create another jquery sample the Simple Online Registration form validation using jQuery. Let’s have a look at what we’ve achieved:
  • Validating the form without third party plugin.
  • We create the dynamic date loop in the field.
  • Simple and working jQuery validation.

Continue Reading...