Posts Tagged ‘JavaScript’

jquery.autocomplete ( facebook search box )

First i would like to thank fromvega for his super awsome work explaining Autocomplete plugin he made

I learned allot from his work and built over it adding some new functionalities and spicing it up

By adding some more good plug-in like highlight-3.yui,

So i was looking through the web searching for a good plug-in search box that is inspired by the contacts search box

In face book and the best plug-in i found was Facebook like Autosuggestion

It was a very good plug-in but i must say it didn’t have some functionalities like the important up/down arrow keys selections also it didn’t highlight the searched text in the suggestions list and when selecting one of the options it didn’t automatically redirect to a target page … Also one of the features i noticed that it didn’t clear the options if the we cleared the search box

So i decided to make my own plug-in that looks exactly the same like the face book search box … You don’t believe me here you go a screen shoot

Or you can try out the Online Demo

So i went through the development path and i wanted to make really simple as one line of code and this what it takes to make the autosuggestion search box now

$("#searchbox").AutoComplete("search.aspx?searchword=");

Very easy haaa ? :-)

You can Visit the Plugin Offical Page on the JqueryPlugins

Or you can direclty Download Plugin

You can also get the source code for the Online Demo Code

So now let us go through step by step in order to use the plug-in

Step 1 : download the plug-in files

Step 2 : include them in the project

Step 3 : add reference to the right files in the html code

<link href="styles/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript">google.load('jquery', '1.3.2');</script>

<script src="styles/js/jquery.autocomplete.js" type="text/javascript"></script>

<script src="styles/js/jquery.dimensions.js" type="text/javascript"></script>

<script src="styles/js/jquery.highlight-3.yui.js" type="text/javascript"></script>

Step 4 : create the html text box and give it ID let us say "DemoSearchBoxID"

Step 5 : add the script calling the plugin

$(function () { 

    $("#DemoSearchBoxID").AutoComplete("search.aspx?searchword="); 

});

Step 6 : develop the Asp.Net search Page in my case "search.aspx" which takes the parameter in the query string

search word having the value of the search box

This page will be called with ajax calls during each key up event of the search box, it should be very simple page to developed for experienced developer.

On the ajax call i am searching in the output result of the search page for a div with id "divAutoCompleteSearch"

And render its html content in the autosuggestions list

The divAutoCompleteSearch should contain list of result divs and each result div should contain two hidden fields with IDS "hdnValue " and "hdnUrl "

hdnValue = the value that will be copied to the search box when selecting this result

hdnUrl = the url the page will be redirected to when selecting this result

Example of the expected output html from the search.aspx

<div id="divAutoCompleteSearch">

 

  <div class="unselected">

    <input id="hdnValue" type="hidden" value='Egypt' />

    <input id="hdnUrl" type="hidden" value='http://targetUrl' />

    <img alt="" src='Egypt.jpg' width="45px" height="45px" />

    Egypt

  </div>

 

  <div class="unselected">

    <input id="hdnValue" type="hidden" value='Denmark' />

    <input id="hdnUrl" type="hidden" value='http://targetUrl' />

    <img alt="" src='Denmark.jpg' width="45px" height="45px" />

    Denmark

  </div>

 

</div>

As i said <div class="unselected"> can contain any html you want to display in the suggestions list any think will work as long as you have the two hidden fields included.

I hope that made it easier for you to use and you make a great use of this plug-in ,i will be happy if you do

You love the topic :-) ? Let me hear what you think … Please give me your comments bellow or Retweet This :-)

Cheers for all jQuery Users.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

jQuery for Everyone

A Very cool Tips and handy Tools to be used with share point can

Be found on those create topics Jquery for everyone :)

Hope you enjoy them

Entries in this series:

  • JQuery for Everyone: Accordion Left Nav
  • JQuery for Everyone: Print (Any) Web Part
  • JQuery for Everyone: HTML Calculated Column
  • JQuery for Everyone: Dressing-up Links Pt1
  • JQuery for Everyone: Dressing-up Links Pt2
  • JQuery for Everyone: Dressing-up Links Pt3
  • JQuery for Everyone: Cleaning Windows Pt1
  • JQuery for Everyone: Cleaning Windows Pt2
  • JQuery for Everyone: Fixing the Gantt View
  • JQuery for Everyone: Dynamically Sizing Excel Web Parts
  • JQuery for Everyone: Manually Resizing Web Parts
  • JQuery for Everyone: Total Calculated Columns
  • JQuery for Everyone: Total of Time Differences
  • JQuery for Everyone: Fixing Configured Web Part Height
  • JQuery for Everyone: Expand/Collapse All Groups
  • JQuery for Everyone: Preview Pane for Multiple Lists
  • JQuery for Everyone: Preview Pane for Calendar View
  • JQuery for Everyone: Degrading Dynamic Script Loader
  • JQuery for Everyone: Force Checkout
  • JQuery for Everyone: Replacing [Today]
  • JQuery for Everyone: Whether They Want It Or Not
  • JQuery for Everyone: Linking the Attachment Icon
  • JQuery for Everyone: Aspect-Oriented Programming with jQuery
  • JQuery for Everyone: AOP in Action – loadTip Gone Wild
  • JQuery for Everyone: Wiki Outbound Links
  • JQuery for Everyone: Collapse Text in List View
  • JQuery for Everyone: AOP in Action – Clone List Header
  • JQuery for Everyone: $.grep and calcHTML Revisited
  • JQuery for Everyone: Evolution of the Preview
  • JQuery for Everyone: Create a Client-Side Object Model
  • JQuery for Everyone: Print (Any) Web Part(s) Plugin
  • JQuery for Everyone: Minimal AOP and Elegant Modularity
  • JQuery for Everyone: Cookies and Plugins
  • JQuery for Everyone: Live Events vs. AOP
  • JQuery for Everyone: Live Preview Pane
  • JQuery for Everyone: Pre-populate Form Fields
  • JQuery for Everyone: Get XML List Data with OWSSVR.DLL (RPC)
  • Use Firebug in IE
  • JQuery for Everyone: Extending OWS API for Calculated Columns
  • JQuery for Everyone: Accordion Left-nav with Cookies Speed Test
  • JQuery for Everyone: Email a List of People with OWS
  • JQuery for Everyone: Faster than Document.Ready
  • jQuery for Everyone: Collapse or Prepopulate Form Fields
  • jQuery for Everyone: Hourly Summary Web Part
  • jQuery for Everyone: "Read More…" On a Blog Site
  • jQuery for Everyone: Slick Speed Test
  • jQuery for Everyone: The SharePoint Game Changer
  • JQuery For Everyone: Live LoadTip

Inserted from <here>

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

JQuery Notes

JQuery Selectors

$(“#firstname”)

select element with id firstname

$(“:text”)

select all text boxes

$(“.required”)

select all elements with required class

$(“#grad tr:even”)

select even rows from an element with an id of grad

JQuery Animation

$(..).Show()

$(..).Hide()

$(..).SlideDown()

$(..).SlideUp()

$(..).FadeIn()

$(..).FadeOut()

to be continued …

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

SharePoint CSS

A great topic explaining all the SharePoint style classes and names

 

Enjoy ; – )

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Html To JavaScript

If you want to render an html using some java script this link will be very useful to you Java To html

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Sharepoint Web Application Two Zones

Configuring Web application to have Two zones windows and forms Authentication

Create the extranet site.

..Application Management -> Create or Extend Web Application > Extend

i. Set the Description

ii. Set the Port [80]

iii. Set the Host Header to [ISSExtra]

iv. Pick NTLM as the Authentication Provider (we’ll change this later)

v. Specify Anonymous Access to No (and this!)

vi. Set the Load Balanced URL Zone to [ISSExtra]

vii. Set the zone to extranet

b. Go back to Application Management and choose Authentication providers

c. Click on the Windows authentication provider link and

ii. Change the authentication to Forms

iii. Add the following as the membership provider: ISSMembershipProvider

iv. Add the following as the role provider: ISSRoleProvider

v. Save

vi. Note: Disabling client integration will remove features which launch client applications. Some authentication mechanisms (such as Forms) don’t work well with client applications. In this configuration, users will have to work on documents locally and upload their changes.

Add the host headers to DNS / hosts file!

a. For DNS (if you have access) add resolvers for ISSExtra. It should resolve to the IP address of your MOSS 2007 server.

b. If you don’t have access to the DNS server edit your hosts file to resolve the addresses.

i. Open the hosts file in notepad, this exists in the [C:\Windows\System32\drivers\etc] directory, assuming Windows is your OS directory.

ii. Make the changes to reflect the following

[MOSS Server IP Address] ISSExtra

Changes in the web config

For forms Authentication using database

i. Create sql database

ii. Run the following programme and choose the targeted database and run through the wizard. <WindowsDirectory>\Microsoft.NET\Framework\<version>\aspnet_regsql.exe

iii. In the web.config of the central administration

Add the following tags with your configuration

After </SharePoint> tag.

 

<connectionStrings>

    <add name="MembershipDatabaseISS" connectionString="SERVER=localhost;DATABASE=ISSBasic; TRUSTED_CONNECTION=true;"/>

</connectionStrings>

Inside <system.web> tag

<membership>

<providers>

<add name="ISSMembershipProvider " 

type="System.Web.Security.SqlMembershipProvider,System.Web, Version=2.0.0.0, 

Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" 

connectionStringName="MembershipDatabaseISS" enablePasswordRetrieval="false" 

enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" 

requiresUniqueEmail="false" passwordFormat="Hashed" 

maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" 

minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" 

passwordStrengthRegularExpression=""/>

</providers>

</membership>

<roleManager>

<providers>

<add name="ISSRoleProvider " connectionStringName="MembershipDatabaseISS" 

applicationName="/" type="System.Web.Security.SqlRoleProvider, 

System.Web,Version=2.0.0.0, Culture=neutral, 

PublicKeyToken=b03f5f7f11d50a3a"/>

</providers>

</roleManager>

iv. On both the intranet and the extra net application web config add the following

After </SharePoint> tag.

<connectionStrings>

    <add name="MembershipDatabaseISS" connectionString="SERVER=localhost;DATABASE=ISSBasic; TRUSTED_CONNECTION=true;" />

</connectionStrings>

Inside <system.web> tag

 

<membership defaultProvider="ISSMembershipProvider">

<providers>

<add name="ISSMembershipProvider" 

type="System.Web.Security.SqlMembershipProvider,System.Web, Version=2.0.0.0, 

Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" 

connectionStringName="MembershipDatabaseISS" enablePasswordRetrieval="false" 

enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" 

requiresUniqueEmail="false" passwordFormat="Hashed" 

maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" 

minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" 

passwordStrengthRegularExpression="" />

</providers>

</membership>

<roleManager enabled="true" defaultProvider="ISSRoleProvider">

<providers>

<add name="ISSRoleProvider" connectionStringName="MembershipDatabaseISS" 

applicationName="/" type="System.Web.Security.SqlRoleProvider, 

System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 

/>

</providers>

</roleManager>

For forms Authentication using AD

Same as forms Authentication using database section but with modifying

The connection string to

<add name="MembershipDatabaseISS" connectionString="LDAP://testdomain1.test.com/CN=Users,DC=testdomain1,DC=test,DC=com" />

2. Add the attribute for both the <add name="ISSMembershipProvider "…

And <add name="ISSRoleProvider "…

connectionUsername="testdomain2\administrator"

connectionPassword="password"

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Create JavaScript From Code Behind

After You Create your JavaScript String In The Code Behind  go to the page load event and this to register the JavaScript to your page

Page.RegisterStartupScript("ScriptString", ScriptString);

 

as I said in my last post some times the id you assign for a control is not always the actual id given to it on the client side

so if you are making JavaScript and using controls id make sure to use control.ID

To change an html

document['docimagename'].src = '/images/imagename.gif'

docimagename is the name attribute of the image

Hide Control

document.getElementById('ControlID').style.visibility = 'hidden';

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Cancel Validation

some times when you are using the asp Validations and want to add cancel button to form

when this button is clicked the from is supposed to cancel all the registration operation still the required field validation shows up asking for a field value

Solution : set the Cancel button Property Cause validation to False

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Java Script Makes It Crazy

Wanna make a website look all crazy and messed up?

1. Go to any website

2. Delete everything in the address bar

3. Paste the following code in the address bar:

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; 

x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; 

i++){DIS=DI[ i ].style; DIS.position='absolute'; 

DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; 

DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);

4. press enter and have fun !!

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

 

View Abdel-Rahman Awad's profile on LinkedIn

Archives

 

Rss Feed Tweeter button Facebook button Linkedin button Delicious button Digg button