CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> General/Other

 RESOLVED wth explation ** autofill based on 2 textboxes

Print topic Send  topic

Author Message
RoyBaird

Posts: 115
Posted: 02/03/2010, 7:10 AM

I have autofill wroking great. BUT, now I need to use it to get data based on 2 text boxes. Here is the setup:
users enters an ID number then a DOB. I want to go get a record based on the concatenated values entered for ID and DOB. DOB triggers the service.

My question; is there a way in the builder to do this, and if so how, or do I need to bit the bullet and hard code it? Using PHP and MySQL.

Thanks,
_________________
Roy
View profile  Send private message
andy


Posts: 183
Posted: 02/26/2010, 7:49 AM

You might be able to do it using javascript first. Haven't tried it but this is how it might work.

1. Enter value in text box 1
2. Enter value in text box 2
3. When you move off text box 2 (onblur or onchange), javascript copies and concatenates the previous 2 values to a hidden field
4. Execute the autofill based on the hidden field but triggered on text box 2 (onblur or onchange)

This is an example of the javascript code to put in the head:
<script type="text/javascript">  
function copyfieldvalues() {  
var tb1 = document.formname.textbox1.value;  
var tb2 = document.formname.textbox2.value;  
document.formname.hiddenfield.value = tb1+tb2;  
}  
</script>  

Then on textbox2 you need to add the above copyfieldvalues() javascript function to the input javascript event (onchange or onblur). This is at the bottom of the first tab (Format) in Properties under Events

<input onblur=" copyfieldvalues()" id="formnametextbox2" value="{Textbox2}" maxlength="12" size="12" name="{Textbox2_Name}">  

Now set up the PTAutoFill by clicking the Feature Builder and attaching it to the hidden field. Once you've set up the autofill for the hidden field, define the "Start event" as onchange for the hidden field (do this in the PTAutoFill properties by clicking on Features (under Data in Properties) and then highlighting PTAutoFill1 in the dialog box.

I haven't tried it but I think this might work. Good luck.
_________________
Andy

RAD tools for rich UI controls:
http://www.koolphptools.com
View profile  Send private message
RoyBaird

Posts: 115
Posted: 03/04/2010, 5:56 AM

Here is the answer that works...

you can use AutoFill Feature that utilizes values of two textboxes. Create an Autofill feature that is 'based' on your textbox that will fire the Ajax request. In order to pass additional parameter to AutoFill Ajax feature please follow the steps:
1. modify the Autofill request call by adding the second parameter (in the HTML code), e.g.
new Ajax.Request("services/AutoFillTest_NewRecord1_TextBox1_PTAutoFill1.php?keyword=" + encodeURIComponent($("NewRecord1TextBox1").value).replace(/'/g, "%27") + "&MyParam=" + encodeURIComponent($("NewRecord1TextBox3").value).replace(/'/g, "%27"), {
Please remember to use real names in the code.

2. open corresponding service page, open Data Source dialog of the Grid form and add new WHERE parameter of URL type and name "MyParam" (in this example).


Be careful of the syntax in the HTML call to Ajax. You can name the second or third parameters anything you wish, but of course it must be the same in the WHERE clause of the Ajax service.

It is that simple, but it took me a couple of false starts.
_________________
Roy
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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