sam
sam

Reputation: 2606

Can't get calendar to display

I have this function that will call JavaScript code that shows a calendar when I click on a text field:

window.onload = function(){
    new JsDatePick({
        useMode:2,
        target:"inputField",
        dateFormat:"%d-%M-%Y"
    });
};

and there is the first calling of the function on first textfield which works fine:

<input name="PickDate" type="text" id="inputField" readonly="readonly"/>

but when I call the same function on the same page it's not working at all and nothing appears. This how I call the function, since I think the problem is with how I'm calling it:

<input name="PickReturnDate" type="text" id="inputField" readonly="readonly"/>

Upvotes: 1

Views: 1560

Answers (3)

sakshi
sakshi

Reputation: 11

I had the same problem. Try this one:

<script type="text/javascript">
    window.onload = function() {
        new JsDatePick ({
            useMode:2,
            target:"inputField1",
            dateFormat:"%d-%M-%Y"
        });
        new JsDatePick ({
            useMode:2,
            target:"inputField2",
            dateFormat:"%d-%M-%Y"
        });
    };
</script>

<td><input type="text" size="12" name="dob" id="inputField1" /></td>
<td><input type="text" size="12" name="doj" id="inputField1" /></td>

Upvotes: 1

Bumble Blee
Bumble Blee

Reputation: 79

Your target is target:"inputField", that's why first one is working and next one is not.

Upvotes: 2

JAiro
JAiro

Reputation: 5999

Try replacing the ´target´.Because the id of you input is inputField2 not inputfield.

 window.onload = function(){
   new JsDatePick({
    useMode:2,
    target:"inputField2",
    dateFormat:"%d-%M-%Y"
   });
};  

Upvotes: 0

Related Questions