Question: I'm designing a page that is supposed to allow users to submit possible computing science projects and at one stage the user will have to enter a duration that the project will run over. To make things easier on the user the I'm trying to fill out the from: to: fields using jQuery's datepicker method however I cannot get the script to run when the user selects the appropriate field.

So far I've got the following script:

```
<h:outputScript library="jquery" name="jquery-1.9.1.js"/>
<h:outputScript library="jquery" name="jquery-ui-1.10.3.custom.js"/>
<h:outputScript library="jquery" name="jquery-ui-1.10.3.custom.min.js"/>

<h:head>
    <title>Add project</title>

    <script type="text/javascript" id="setDate">
        $(function() {
            $(" #datepicker ").datepicker();
        });
    </script>
    <!-- rest omitted for readability -->

```

and my h:inputText looks like this:

```
<h:inputText id="setDate" value="" onclick="$('#datepicker').datepicker();"/>
<p>Date: <input type="text" id="datepicker" /></p>

```

I did try to make it work without using any jsf tags and managed to get it up and running but I just can seem to make it work with jsf tags.

The problem is that when in a browser the jQuery datepicker widget does not display upon clicking on the field. Clicking on the field defined using the standard `<input>` tag works correctly.

Any help is greatly appreciated, thanks.

Answer: 
I have done this in my way using few xml and not changing anything else.Thought to share with you guys who are going for the solution.

First i have created a custom selector drawable xml file for my button

here it is 

```
  <selector xmlns:android="http://schemas.android.com/apk/res/android" >
 <item android:state_pressed="true" >
     <shape android:shape="rectangle"  >
         <corners android:radius="3dip" />
         <stroke android:width="1dip" android:color="#83776b" />
         <gradient  android:angle="-90"  android:startColor="#5f4427" android:endColor="#cbb59d"  />           
     </shape>
 </item>
<item android:state_focused="true">
     <shape android:shape="rectangle"  >
         <corners android:radius="3dip" />
         <stroke android:width="1dip" android:color="#83776b" />
         <solid  android:color="#92806c"/>      
     </shape>
 </item> 
<item >
    <shape android:shape="rectangle"  >
         <corners android:radius="3dip" />
         <stroke android:width="1dip" android:color="#83776b" />
         <gradient  android:angle="-90"  android:startColor="#cbb59d"    android:endColor="#92806c" />           
     </shape>
   </item>
</selector>

```

Then in my activity i have included this two lines

```
 Button b = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
        if(b != null)
                   b.setBackgroundDrawable(getResources().getDrawable(R.drawable.dialogbutton));

 Button c = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
        if(c != null)
                   b.setBackgroundDrawable(getResources().getDrawable(R.drawable.dialogbutton));

```

Easy solution for me that has worked.
As per your requirement u have to design custom dialog layout this layout contains one textview and 2 buttons which look as default alert dialog. and write listeners for two buttons and design buttons according to your requirement .