Nice Barney...I a total JavaScript novice, but I'll have a go
at implementing this.

I'm very interested RIA's and have tried with Flash with
each version that comes out...but I just hate the interface,
even with the enhancements for developers in 2004.

Perhaps I should just bite the bullet and learn JavaScript...

If I were embarking on learning JavaScript without any knowledge
of it, what resource would you recommend I use?
Is there a "JavaScript for Dummies" type resource out there?

Thanks for the insight!

Rick


-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 26, 2005 2:56 PM
To: CF-Talk
Subject: Re: just noticed this when validating email


Yeah, the file fields was me too.

You don't do a server request, you do it all client-side with
javascript.  I didn't test this, but here's the general idea:

<script type="text/javascript">
  window.emailFieldCount = 1;
  function addField() {
    var div = document.getElementById("fieldContainer");
    div.innerHTML += '<input name="email' + ++window.emailFieldCount +
'" /><br />';
  }
</script>
<div id="fieldContainer">
 <input name="email1" /><br />
</div>
<a href="javascript:addField();">add field</a>

Walking through the code, we've got a single field hard coded in the
page, along with a field count stored in a variable
(window.emailFieldCount), which is initalized to one (because of the
one hard coded field).  When you click the 'add field' link, the
addField() function is called, which find the div that contains the
input fields, and adds another field to the end, incrementing the
field count variable and using it to set the field name to be unique.
I've opted to use innerHTML rather than the DOM for appending the
fields for simplicity's sake; either should work.

This is a first little window into building javascript RIAs, where the
entire app no longer resides on the server, but part of the UI
controller has moved to the client.

cheers,
barneyb

On Sat, 26 Mar 2005 14:01:16 -0500, Rick Faircloth
<[EMAIL PROTECTED]> wrote:
> Hi, Barney...
>
> I think it was you, perhaps, who suggested the same
> approach to dynamically adding CFFILE fields to a page
> so that any number of photos could be uploaded at once.
>
> In the email below, you suggest adding a button/link to click
> so another field would be added for email addresses.
>
> What the code overview on this...just have the page submit
> back to itself, check a variable of some sort, and if it's a certain
> value have another field show up?
>
> Care to elaborate on the process you're thinking of?
>
> Rick

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200102
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

Reply via email to