Great Bobby. Works fine now. After several tests our form works
properly. JS is a new world for me. Good job.
Cheers
MD
2005/10/24, Bobby Hartsfield <[EMAIL PROTECTED]>:
> Sorry, I had to run out for a minute. I saw javascript/dynamic fields and
> fired off an email. This seems to be a little more dedicated to what you
> described and should get you going. (only tested in the latest versions of
> IE and FF)
>
> <script>
>
> function popitup()
> {
> alert("Put the code to popup your calendar here");
> }
>
>
> function addBtn(incrementer)
> {
>
> //Create the button object
> var Newbtn = document.createElement('button');
>
> //Give the button a name (if it matters)
> Newbtn.name = "myBtn" + document.getElementById('fldCounter').value;
>
> //Add the text you want to display on the button
> var NewbtnText = document.createTextNode('Click here and choose your
> date');
>
> //Add the text to the button
> Newbtn.appendChild(NewbtnText);
>
> //Add the onclick handler
> Newbtn.onclick = popitup;
>
> //Add little pzzazz to it
> Newbtn.style.borderWidth = "1";
> Newbtn.style.borderColor = "#000000";
> Newbtn.style.backgroundColor = "#ececec";
>
> //Add the button to the page
> document.getElementById('myContainer').appendChild(Newbtn)
>
> //Add a couple line breaks
>
> document.getElementById('myContainer').appendChild(document.createElement('b
> r'));
>
> document.getElementById('myContainer').appendChild(document.createElement('b
> r'));
>
> //Don't feel like this HAS to be a button. It could be an image or a
> text link, or anything else you can think of.
>
> document.getElementById('fldCounter').value =
> Number(document.getElementById('fldCounter').value) + 1
> }
> </script>
>
> <input type="hidden" id="fldCounter" name="fldCounter" value="0">
> <a href="javascript:void(0)" onclick="addBtn();">Add The Button</a>
> <div id="myContainer">
>
> </div>
>
>
>
>
> ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
> Bobby Hartsfield
> http://acoderslife.com
>
> -----Original Message-----
> From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 24, 2005 5:51 PM
> To: CF-Talk
> Subject: RE: SOT - Creating dynamically name field with JS
>
> Look into the createElement() function. Works like a charm.
>
> Here is some pseudo...
>
> <script>
> function addfld(incrementer)
> {
> //Build the form field
> Newfld = document.createElement('input')
> Newfld.type = "text";
> Newfld.name="mynewfield" + incrementer;
>
> document.getElementById('myContainer').appendChild(Newfld)
>
> //Add a line break
> document.getElementById('myContainer').appendChild(document.createElement('b
> r'));
> }
> </script>
>
> <a href="javascript:void(0)" onclick="addfld('2')">Add New Field</a>
> <div id="myContainer">
> <input type="text" name="mynewfield1"><br>
> </div>
> Completely off the top of my head so im sure there are errors in it but
> hopefully you get the idea.
>
> Just look up createElement() and appendChild(). Let me know if you need
> anymore help with it if you decide to go this way. I've got some pretty
> cross browser friendly versions of it.
>
> ...:.:.:.:.:.:.:.:.:.:.:.:.:.:.
> Bobby Hartsfield
> http://acoderslife.com
>
> -----Original Message-----
> From: Michel Deloux [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 24, 2005 4:55 PM
> To: CF-Talk
> Subject: SOT - Creating dynamically name field with JS
>
> Hi all
>
> sorry by OT but I need your help in JS.
>
> I have a form with only one field. I'll like to present that field
> with an option for insert more fields like that and/or exclude others
> fields. This is my form:
>
> <form name="frm" action="post">
>
> <INPUT size="50" maxlength="20" name="datefield" onKeyPress="return false;">
> <SCRIPT language=javascript>
> document.write("<input type=button
> onclick='popUpCalendar(this,
> frm.datefield, \"mm/dd/yyyy\")' value='Click here and choose your
> date'>")
> </SCRIPT>
> </form>
>
> I tested several methods for include/exclude but I don't know how to
> insert that popUpCalendar script inside new field with dynamic name
> field.
>
> What's wrong? How to create dynamically name field for my popUpCalendar?
>
> Thanx for your time.
>
> Cheers
>
> MD
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222204
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54