Attach calendar to text field and icon

I want to attach the calendar to a icon and a text field.

I used this and text field worked.

    <script>
        var myCalendar1;
        function doOnLoad() {
     	  myCalendar1 = new dhtmlXCalendarObject(["date"]);
     	  myCalendar1.setDateFormat("%m/%d/%Y");
	 	  myCalendar1.hideTime();
	 	  myCalendar1.disableDays("week", [0, 6]);
	 	  myCalendar1.setWeekStartDay(0);
	 	  myCalendar1.setDate("03/16/2015");
     	  myCalendar1.setInsensitiveRange(null, "03/15/2015");
        }
    </script>

but I also wanted to add a icon as well. So I changed the code to this.

    <script>
        var myCalendar1;
        function doOnLoad() {
     	  myCalendar1 = new dhtmlXCalendarObject({input:\"date\",button:\"calendar_icon\"});
     	  myCalendar1.setDateFormat("%m/%d/%Y");
	 	  myCalendar1.hideTime();
	 	  myCalendar1.disableDays("week", [0, 6]);
	 	  myCalendar1.setWeekStartDay(0);
	 	  myCalendar1.setDate("03/16/2015");
     	  myCalendar1.setInsensitiveRange(null, "03/15/2015");
        }
    </script>

This allowed the icon to work, but now the calendar does not pop up when I click the text field only the icon. If there a way to have the icon and a click in the text field both open the calendar.

Thanks.

OK,

After playing around this weekend I ended up using the following code and was able to get my code to work.

    <script>
        var myCalendar;
        function doOnLoad() {
myCalendar = new dhtmlXCalendarObject([
     	    { input: \"pmtdate\" }, {input:\"date\",button:\"calendar_icon\"}
     	  ]);
     	  myCalendar.setDateFormat(\"%m/%d/%Y\");
	  myCalendar.hideTime();
	  myCalendar.disableDays(\"week\", [0, 6]);
	  myCalendar.setWeekStartDay(0);
	  myCalendar.setDate(\"03/16/2015\");
     	  myCalendar.setInsensitiveRange(null, \"03/15/2015\");
        }
    </script>

I hope this can help out someone else.