CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Ajax Dynamic Client Lookup

Print topic Send  topic

Author Message
andy


Posts: 183
Posted: 06/21/2007, 12:39 PM

If you are looking for a neat solution to populate fields in a form based upon another field in the same form that looks up related fields from another table then returns them to the form without having to refresh or submit the form, then look no further...

The demo can be found at:

http://www.dhtmlgoodies.com/scripts/ajax-client-lookup/...ent-lookup.html

The code can be found at :

http://www.dhtmlgoodies.com/index.html?whichScript=ajax_client_lookup

Follow the instructions there and download the script and apply to your form.
A few things that will hopefully save you some time:
1) You need to create a matching "id" for the lookup field on your form in the data format properties ("ClientID" in the example).
2) You need to specify the name of the form. Click on the form and see under "Name" on the Data Properties tab in CCS. This form name should be entered where it says 'clientform' in the head section of the example:

function showClientData()  
	{  
		var formObj = document.forms['clientForm'];	  
		eval(ajax.response);  
	}

3) You may find that you need to simplify or modify the following line of code in the head section of the example given

		if(clientId.length==4 && clientId!=currentClientID){ 

by changing it to:

		if(clientId!=currentClientID){ 

4) Make sure you get the path right that corresponds to the folder in which you put the file "ajax.js"
In the head section of the example they give:
<script type="text/javascript" src="/AJAX/ajax.js"></script>

I changed the above to:
<script type="text/javascript" src="AJAX/ajax.js"></script>
and placed the ajax.js file in root/AJAX folder.

I hope this helps. It's worth the fiddle.

ADDITIONAL NOTE:
Depending on the content of the data in your lookup field, you may need to change this piece of javascript using a regular expression to strip out all non-numerical characters:

var clientId = document.getElementById('clientID').value.replace(/[^0-9]/g,'');

the value.replace(/[^0-9]/g,'') replaces any non-numeric characters with nothing.
_________________
Andy

RAD tools for rich UI controls:
http://www.koolphptools.com
View profile  Send private message
DonB
Posted: 06/21/2007, 2:51 PM

I suggest looking just a 'bit' farther: http://jquery.com

The jquery environment provides a much simpler way to access the HTML dom,
and to implement ajax/JSON functionality.

--
DonB

http://www.gotodon.com/ccbth


"andy" <andy@forum.codecharge> wrote in message
news:5467ad3ee50e24@news.codecharge.com...
> If you are looking for a neat solution to populate fields in a form based
upon
> another field in the same form that looks up related fields from another
table
> then returns them to the form without having to refresh or submit the
form, then
> look no further...
>
> The code can be found at :
>
> http://www.dhtmlgoodies.com/index.html?whichScript=ajax_client_lookup
>
> Follow the instructions there and download the script and apply to your
form.
> A few things that will hopefully save you some time:
> 1) You need to create a matching "id" for the lookup field on your form in
the
> data format properties ("ClientID" in the example).
> 2) You need to specify the name of the form. Click on the form and see
under
> "Name" on the Data Properties tab in CCS. This form name should be entered
where
> it says 'clientform' in the head section of the example:
>
>
function showClientData()  
> {  
> var formObj = document.forms['clientForm'];  
> eval(ajax.response);  
> }
>
> 3) You may find that you need to simplify or modify the following line of
code
> in the head section of the example given
>
>
 if(clientId.length==4 && clientId!=currentClientID){ 
>
> by changing it to:
>
>
 if(clientId!=currentClientID){ 
>
> 4) Make sure you get the path right that corresponds to the folder in
which you
> put the file "ajax.js"
> In the head section of the example they give:
>
<script type="text/javascript" src="/AJAX/ajax.js"></script>
>
> I change the above to:
>
<script type="text/javascript" src="AJAX/ajax.js"></script>
> and placed the ajax.js file in root/AJAX folder.
>
> I hope this helps. It's worth the fiddle.
> _________________
> Many thanks
>
> Andy
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Damian Hupfeld
Posted: 06/27/2007, 4:56 AM

I looked at many of the examples on your link Don and more than half of them
did not display on my IE6 browser with slighly lower than standard security
settings (eg more likely to work)....

"DonB" <~ccbth~@gotodon.com> wrote in message
news:f5ertd$hbl$1@news.codecharge.com...
>I suggest looking just a 'bit' farther: http://jquery.com
>
> The jquery environment provides a much simpler way to access the HTML dom,
> and to implement ajax/JSON functionality.
>
> --
> DonB
>
> http://www.gotodon.com/ccbth
>
>
> "andy" <andy@forum.codecharge> wrote in message
>news:5467ad3ee50e24@news.codecharge.com...
>> If you are looking for a neat solution to populate fields in a form based
> upon
>> another field in the same form that looks up related fields from another
> table
>> then returns them to the form without having to refresh or submit the
> form, then
>> look no further...
>>
>> The code can be found at :
>>
>> http://www.dhtmlgoodies.com/index.html?whichScript=ajax_client_lookup
>>
>> Follow the instructions there and download the script and apply to your
> form.
>> A few things that will hopefully save you some time:
>> 1) You need to create a matching "id" for the lookup field on your form
>> in
> the
>> data format properties ("ClientID" in the example).
>> 2) You need to specify the name of the form. Click on the form and see
> under
>> "Name" on the Data Properties tab in CCS. This form name should be
>> entered
> where
>> it says 'clientform' in the head section of the example:
>>
>>
function showClientData()  
>> {  
>> var formObj = document.forms['clientForm'];  
>> eval(ajax.response);  
>> }
>>
>> 3) You may find that you need to simplify or modify the following line of
> code
>> in the head section of the example given
>>
>>
 if(clientId.length==4 && clientId!=currentClientID){ 
>>
>> by changing it to:
>>
>>
 if(clientId!=currentClientID){ 
>>
>> 4) Make sure you get the path right that corresponds to the folder in
> which you
>> put the file "ajax.js"
>> In the head section of the example they give:
>>
<script type="text/javascript" src="/AJAX/ajax.js"></script>
>>
>> I change the above to:
>>
<script type="text/javascript" src="AJAX/ajax.js"></script>
>> and placed the ajax.js file in root/AJAX folder.
>>
>> I hope this helps. It's worth the fiddle.
>> _________________
>> Many thanks
>>
>> Andy
>> ---------------------------------------
>> Sent from YesSoftware forum
>> http://forums.codecharge.com/
>>
>
>

TonyReid


Posts: 159
Posted: 06/27/2007, 5:20 AM

Hi, Andy,

Welcome to the CC forums.

Great first post :)

Thanks for the tip.

Tony

_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
klwillis


Posts: 428
Posted: 06/28/2007, 9:47 AM

Nice interum solution - prior to AJAX integration into CCS.

Quote DonB:
I suggest looking just a 'bit' farther: http://jquery.com

The jquery environment provides a much simpler way to access the HTML dom,
and to implement ajax/JSON functionality.

--
DonB

http://www.gotodon.com/ccbth


"andy" <andy@forum.codecharge> wrote in message
news:5467ad3ee50e24@news.codecharge.com...
> If you are looking for a neat solution to populate fields in a form based
upon
> another field in the same form that looks up related fields from another
table
> then returns them to the form without having to refresh or submit the
form, then
> look no further...
>
> The code can be found at :
>
> http://www.dhtmlgoodies.com/index.html?whichScript=ajax_client_lookup
>
> Follow the instructions there and download the script and apply to your
form.
> A few things that will hopefully save you some time:
> 1) You need to create a matching "id" for the lookup field on your form in
the
> data format properties ("ClientID" in the example).
> 2) You need to specify the name of the form. Click on the form and see
under
> "Name" on the Data Properties tab in CCS. This form name should be entered
where
> it says 'clientform' in the head section of the example:
>
>
function showClientData()  
> {  
> var formObj = document.forms['clientForm'];  
> eval(ajax.response);  
> }
>
> 3) You may find that you need to simplify or modify the following line of
code
> in the head section of the example given
>
>
 if(clientId.length==4 && clientId!=currentClientID){ 
>
> by changing it to:
>
>
 if(clientId!=currentClientID){ 
>
> 4) Make sure you get the path right that corresponds to the folder in
which you
> put the file "ajax.js"
> In the head section of the example they give:
>
<script type="text/javascript" src="/AJAX/ajax.js"></script>
>
> I change the above to:
>
<script type="text/javascript" src="AJAX/ajax.js"></script>
> and placed the ajax.js file in root/AJAX folder.
>
> I hope this helps. It's worth the fiddle.
> _________________
> Many thanks
>
> Andy
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>



_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
username

Posts: 24
Posted: 09/09/2007, 9:10 AM

hi andy ,give me please your example:-)
View profile  Send private message
andy


Posts: 183
Posted: 09/09/2007, 12:22 PM

Hi "username"

I think you'll find all the information you need in my initial post. There's a demo link to show you how it works and a link to the files. If you follow my top tips, this will hopefully make it easier for you.
Give it a go and see how you get on. I wish you success.


_________________
Andy

RAD tools for rich UI controls:
http://www.koolphptools.com
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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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