First: It is *awesome* that Rob has written a distro of AjaxCFC for
jQuery. I started playing with the alpha release last night. Very cool
stuff.
Second: There is probably a much more succinct way of doing this in
jQuery. I'm not the absolute best person to ask. Also, my code below
only requires that the text field to be changed has an ID. That ID could
be passed into the function if necessary. The inputs could have dynamic
IDs just the same as they have dynamic names.
To be honest, I didn't really understand the original request, but this
was the best I could make out.
Is the Select box created dynamically? If so, the dynamic ID of the
corresponding text box could be passed too. jQuery could also have
gotten the input element by class or just by element type. Of course, if
it was done by class or element type, it would change the value of *all*
elements with that class or of that element type. That's why I chose ID.
jQuery even allows you to use XPath selectors, though I have very little
idea what that means (I've seen it done a couple of times), but I
thought I'd mention it in case it made any sense to you. :o)
Cheers,
Chris
Charlie Griefer wrote:
> couple of things (and just to throw it out there, i am in no way
> against jQuery...i haven't used it yet, but am fixing to download it
> and start playing around with it...especially now that Rob G. has
> integrated AjaxCFC into it).
>
> in this case, i don't think using the library really saves you
> anything. my original code (which would have worked without the
> quotes around the 2nd argument) is really not much more verbose than
> the jquery code below. also, the code below doesn't take into account
> the dynamic field naming. it seems to assume there will be 1 select
> field and one corresponding text field.
>
> just seems that it might be overkill for the problem at hand. seems
> dead simple without jQuery (again, if'n i hadn't messed up the quotes
> on that 2nd argument) :)
>
> On 12/28/06, Christopher Jordan <[EMAIL PROTECTED]> wrote:
>
>> This would be dead simple using jQuery.
>>
>> I just wrote and tested this. I think it does what you want.
>>
>> <html>
>> <head>
>> <title></title>
>> <script src="/include/js/jquery.js"></script>
>> <script>
>> function myFunction(thisValue){
>> if(thisValue == "OUT OF STOCK"){
>> $("#myID").val("0");
>> }
>> }
>> </script>
>> </head>
>>
>> <body>
>> <select name="Comments#getLineItems.CurrentRow#"
>> OnChange="myFunction(this.value)">
>> <option value="SHIPPED"SHIPPED</option>
>> <option value="SHIPPED AVAILABLE">SHIPPED AVAILABLE</option>
>> <option value="DISCONTINUED">DISCONTINUED</option>
>> <option value="OUT OF STOCK">OUT OF STOCK</option>
>> </select>
>>
>> <input id="myID" type="text"
>> name="QTYShipped#getLineItems.CurrentRow#" value="1" size="4" maxlength="3">
>> </body>
>> </html>
>>
>> You would, of course, have to download the jquery library and change the
>> path to it appropriately.
>>
>> You can find it here <http://www.jquery.com>.
>>
>> Hope this helps.
>>
>> Cheers,
>> Chris
>>
>> Che Vilnonis wrote:
>>
>>> I have a form with a varied number of form fields (they are dynamically
>>> created). Two of the form fields are a input box and a select box. I loop
>>> through my query and define the form names like so:
>>>
>>> <input type="text" name="QTYShipped#getLineItems.CurrentRow#" value="1"
>>> size="4" maxlength="3">
>>>
>>> and
>>>
>>> <select name="Comments#getLineItems.CurrentRow#">
>>> <option value="SHIPPED">SHIPPED</option>
>>> <option value="SHIPPED AVAILABLE">SHIPPED AVAILABLE</option>
>>> <option value="DISCONTINUED">DISCONTINUED</option>
>>> <option value="OUT OF STOCK">OUT OF STOCK</option>
>>> </select>
>>>
>>> How can I, using Javascript, use an onChange event so that when "OUT OD
>>> STOCK" is selected from the pulldown, the text value is auto changed from 1
>>> to 0. I am getting hung up with the dynamic form names and declaring them in
>>> my javascript function.
>>>
>>> Hope this makes sense? Che
>>>
>
>
--
http://www.cjordan.info
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265262
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4