PDA

View Full Version : Popupcalendar with dynamically created text box



korssane
07-28-2011, 07:42 PM
Hi Experts,

i'am able create dynamically 2 text boxes ( start date & End Date) . Also i am able to create dynamically (img) calendar gif pictures beside each textbox.
What i am stuck on is how to popup a calendar while clicking on the img and assign the date to a dynamic texboxes...

Any help is much appreciated..

thank you


here is the part of my code :

// Create Start Date Text box
var newStartDate = document.createElement('input');
newStartDate.setAttribute("type","date");
newStartDate.size=8;


// Create calendar 1 img
var newCalImg1 = document.createElement('img');
newCalImg1.src = "../media/forms/cal.gif";



// Create End Date Text box
var newEndDate = document.createElement('input');
newEndDate.size=8;

// Create calendar2 img
var newCalImg2 = document.createElement('img');
newCalImg2.src = "../media/forms/cal.gif";

chump2877
07-28-2011, 08:20 PM
Pick a script -- there are many to choose from: http://lmgtfy.com/?q=javascript+calendar+date+picker

korssane
07-28-2011, 08:31 PM
Hi R.J,
thanks for the quick reply .
but i have my calendar.js that i can call ..,the problem is how can i get the value of the calendar assigned to dynamically created textbox..

In the same timie..do you know how can i capture the value of a dynamically created textbox in Javascript ?

thanks a lot

chump2877
07-28-2011, 09:07 PM
Hi R.J,
thanks for the quick reply .
but i have my calendar.js that i can call ..,the problem is how can i get the value of the calendar assigned to dynamically created textbox..

In the same timie..do you know how can i capture the value of a dynamically created textbox in Javascript ?

thanks a lot

you get the value of a textbox like so:


<form name="myform">
<input type="text" id="mytextbox" name="mytextbox" />
</form>

<script type="text/javascript">
var tboxValue = document.myform.mytextbox.value; // OR
var tboxValue = document.getElementById('mytextbox').value;
</script>

To help you with your specific problem, we would need to see all calendar.js code as well as the HTML file that includes calendar.js.