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 -> PHP

 Select Value for jquery jCombo Plugin after reload

Print topic Send  topic

Author Message
thomas2340

Posts: 55
Posted: 05/18/2014, 3:20 AM

Hi,

iam using ccs 5.1.1.18990 with php and mysql on linux serverside.

iam using the jquery plugin JCombo to be more flexible with selectboxes.

the following code run fine for me:

<head>
<script src="test/js/jquery.min.js"></script>
<script src="test/jquery.jCombo.js"></script>
</head>

<body>

<p>
<select id="SelectFirma" style="WIDTH: 250px" name="SelectFirma">
<option selected>{firma}</option>
</select>
</p>
<p>
<select id="SelectPerson" style="WIDTH: 250px" name="SelectPerson">
<option selected>{person}</option>
</select>
</p>

<script>
$("#SelectFirma").jCombo({
url: "test/getFirma.php",
initial_text: "Firma auswählen"
});

$("#SelectPerson").jCombo({
url: "test/getPerson.php",
initial_text: "Person auswählen"
});
</script>
</body>

the both sql.php files are fired with json. (for your interest)

my problem is that the selected values will go to the database table, but after rrload the page they are not shown, but still in the database.

i try this <option selected>{firma}</option> but it seems that the variables are not set at this moment, has anyone an idea ?

thanx
View profile  Send private message
eratech


Posts: 513
Posted: 05/18/2014, 7:58 PM

Howdy, you are right about the values not being there when the page is reloaded - the selection of the value from the database is done in the PHP page, and as there is nothing in the listbox when it runs (before the HTML is sent to the browser, and the jcombo populates the listbox)

You can either put the listbox values in using the CCS datasource to populate them (that is, don't use jcombo, but I suspect that's not an option), or use the jquery to set the values after jcombo has populated them.

For example, put the SelectFirma database value into a hidden field 'hidden_firma' and put some jquery after the jcombo load to set the SelectFirma listbox to the value from the hidden_firma field.

Let me know how you go

Cheers

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
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.

Web Database

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.