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

 Make selection in listbox and then automatically update multiple fields

Print topic Send  topic

Author Message
Markie


Posts: 251
Posted: 08/13/2007, 11:28 AM

I'm building an application to administer student records. The names, birthdays, nationalities etc. of the students are in a separate database table (as these details never change). Now, in my application I have made a listbox in which I can select the name of a student.

Now, I wonder if it is possible to select a name of a student and then my application automatically updates several other fields in my application (like date of birth, place of birth, gender, nationality of the specific student).

Thanx again

Mark ;-)
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
Markie


Posts: 251
Posted: 08/14/2007, 4:13 AM

I have tried several options, and also other postings don't help me out ...
What do I have to do, anyone ?
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 08/14/2007, 6:53 PM

Markie
What options have you tried??

It appears to me that you are going to have to create custom code to accomplish your objective. The custom code should probably be placed in a specific server side event ( http://docs.codecharge.com/studio31/html/Components/Eve...r/Overview.html ).
View profile  Send private message
jacombs

Posts: 3
Posted: 08/14/2007, 7:09 PM

Hi Guys,
Just joining in for the first time and I must admit that I have spent 10-15 hours trying to do the same thing with no success. Is there no clear direction to achieve the desired result?

Signed
totally frustrated
View profile  Send private message
Markie


Posts: 251
Posted: 08/15/2007, 12:01 AM

mamboBROWN, I have tried several options and I seem to be stuck. I also tried After Update Event, but I can't seem to understand how to control other fields with these kind of events. Sometimes I think Codecharge coding is far over my head ...

The reaction of jacombs shows there is a need of this procedure, so if somebody can make a working example he / she will be a hero forever.
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
wkempees
Posted: 08/15/2007, 3:53 AM

A working example for what situation.
MamboBrown corrctly asked for more details as you are describing
several possible scenarios.

You could be addressing Dependant Listboxes
or just a Lookup secondary data scenario
apart from others.

Walter

Markie


Posts: 251
Posted: 08/15/2007, 4:53 AM

goedenmiddag Walter,
I have tried dependant listboxes from the example pack, this turned out not to be the right solution. I also tried popup solution, also not the right solution.

The scenario I mean:

1) I have a record form (made with record builder);
2) with one listbox;
3) the data source of this listbox is a seperate database table;
4) the form also contains three (or more) textboxes;
5) I make a selection in the listbox;
6) after I made a selection the textboxes are automatically filled with the details (details which belong to the record which is selected in the listbox), the purpose of this is that I (or my clients) don't have to fill in all these textboxes;
7) I press the Submit button and the contents of the record form is add to my main MySQL database table

I simply try to find the easiest solution

thanks again,

M
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
jacombs

Posts: 3
Posted: 08/15/2007, 5:05 PM

Hi again,
My situation is similar to Markie's. On a form I have a listbox which looks up a table containing suburbs and postcodes.
I want the list box to look up the suburb and for the postcode associated with the suburb to be assigned to a text box. Easy or so I thought.... not true from all that I have read in the last 2 days.
Any help would be greatly appreciated.

J
View profile  Send private message
datadoit.com
Posted: 08/15/2007, 5:54 PM

Look at the CCS Example Pack 2, Retrieving field values from the server
on the fly:

http://examples.codecharge.com/CCSExamplePack2/Retrievi...ieldsValues.php
jacombs

Posts: 3
Posted: 08/15/2007, 11:18 PM

Thank you for your feedback...
I followed the example perfectly until I came to the part where it says to copy the HTML code and paste it into my example..... I do not have the example pack as listed so I cannot use the CCS product to view the code. I have sent off a ticket to the support section to see if they can help.

Any ideas????

J
View profile  Send private message
Markie


Posts: 251
Posted: 08/16/2007, 2:58 AM

Hi, the on the fly option is exactly what I mean! I can also rebuild the example (with IntranetDB) but still have to try and build my own.

Jacombs, the javascript you will have to copy and paste in your example is:

<script>

function OpenCustomerInfo(cust_id) {



var win = window.open("GetCustomerInfo.php?customer_id="+cust_id,"CustomerInfo","height=1,width=1,toolbar=no,scrollbars=no,menubar=no");

win.focus();

}

</script>





Your GetCustomerInfo page only has to contain this html contents:





<html>

<head>

<title>Please Wait...</title>

<script language="Javascript">

function getCustomerInfo(){



window.opener.document.orders1.order_ship_address.value = "{yourlabel1}";

window.opener.document.orders1.order_ship_city.value = "{yourlabel2}";

window.opener.document.orders1.order_ship_state.value = "{yourlabel3}";

window.opener.document.orders1.order_ship_zip.value = "{yourlabel4}";





window.opener.focus();

window.close();

}

</script>

</head>

<body onload="getCustomerInfo();">

Please Wait

</body>

</html>

I hope you will succeed too !

Markie
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
Hidran
Posted: 08/16/2007, 10:03 AM

Hi all,
It could be done using ajax.
I use scriptaculous library.
I put onchange event of the listbox and put my ajax
call that returns a JSON object then I update my fields on the
fly without refreshing the page.

An example:
I create a file call ajax_func.php where I have my helper functions
function getUserData($userid){
$conn=new clsDBMyconn();
$res='';
$sql="select user_name,user_surname from users where
user_code='$userid'";
$conn->query($sql);
if($conn && $conn->num_rows()){
$conn->next_record();
$res="{user_name:'$user_name',user_surname:'$user_surname''};";

}
return $res;
}
if($_REQUEST['call'] && $_REQUEST['call']=='getUserData' &&
!empty($_REQUEST['userid'])){
echo getUserData($_REQUEST['userid']);
}
Then onchange event:
var userid=this.options[this.selectedIndex].value;
var pars="call=getUserData&userid="+userid;
new Ajax.Request('ajax_func.php' , {
onComplete : function(resp) {
eval("var obj="+resp.responseText);
$('user_name').value=obj['user_name'];
$('user_surname').value=obj['user_surname'];
},
onFailure : function(resp) {
alert(" there's been an error.");
},
parameters : pars
});

Hidran

"Markie" <Markie@forum.codecharge> ha scritto nel messaggio
news:546c0a2e7d5b32@news.codecharge.com...
> I'm building an application to administer student records. The names,
> birthdays,
> nationalities etc. of the students are in a separate database table (as
> these
> details never change). Now, in my application I have made a listbox in
> which I
> can select the name of a student. Now, I wonder if it is possible to
> select a
> name of a student and then my application automatically updates several
> other
> fields in my application (like date of birth, place of birth, gender,
> nationality of the specific student).
>
> Thanx again
>
> Mark ;-)
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

Markie


Posts: 251
Posted: 08/18/2007, 1:50 AM

Wow, this has kept me off the streets for several days !

Based on Hidran's comment about Ajax, and also klwillis' posting here:

http://forums.yessoftware.com/posts.php?post_id=88474&s_keyword=ajax

I found a great solution (there are still some rough edges but I'm getting where I want!)

I certainly didn't like the "on the fly" solution from example pack 2 because of the pop-up (which is immediately shot down by my Spyware Doctor and IE6). Ajax doesn't require a pop-up or a page refresh and that's really cool !

Thanks you all,

Markie
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
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.