CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Inserting custom Javascript

Print topic Send  topic

Author Message
npglvr

Posts: 12
Posted: 05/30/2006, 9:25 AM

I'm looking to take the value from a drop down and use it to pre-poulate other fields based on the selection. The values and the drop down are all in the same dB table. I want to do this without reloading the screen.

I plan on doing a query and then outputing all of the info into js variables. Then when a selection is made (onChange) I'll retreive the variable that goes with that selection and write it to the correct field.

1) Is there a better way to achieve this
2) If not, then my real issue is populating all of the variables when the page loads for the first time. How do I do this? I can't put the code in the html page, because I can't use the CF in there.

Thanks in advance.
View profile  Send private message
marcwolf


Posts: 361
Posted: 05/30/2006, 11:19 PM

Hi Npglvr

Another way (which we use here) is to do a server callback.

You can achive this using either an iframe or with Ajax

Now - what you do is to populate your first listbox and then using the Javascript OnChage - call a JS function that calls the server.

The Server will then create a block of JavaScript code that will populate the other listbox.

The channel that you can use is an iframe. The inital onchange changes the URL of the iframe (Server - get me all items with XXX as its code)

The Server then generates Javascript code and sends it back to the Iframe

i.e.
parent.window.clearlistbox
parent.window.additem listbox, aa,bb
parent.window.additem listbox, ab,bc

And this is run to populate the listboxes. Or text fields. Basically anything you want to.

Here is an example of somtething similar but it will give you the concepts.

http://www.atgconsulting.com/gofetch.asp

Also this is an excellent article on it as well.

http://developer.apple.com/internet/webcontent/iframe.html

and this

http://www.dyn-web.com/dhtml/iframes/


We also use iframes to show pop-up pages ontop of the main page and communicate back and forth between the iframe the the parent page. This is excellent for look-ups, specific information etc.

And it add a level of richness to the overall interface.

Hope this helps

Dave






_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
npglvr

Posts: 12
Posted: 05/31/2006, 12:18 PM

BINGO!

That did the trick. Thanks a TON for the info!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.