Populate the values of a dropdown and insert the values into different table
Hi All,
I'm new to QCubed. I want to appreciate the core developers of QCU first for this greatful framework. It helped me a lot.
This question may be very basic, but I don't know how to do it. This will help me to learn more about this framework.
I've 3 tables in my DB which is attached in this post. I don't need any modifications in ClientDetails edit/list page. But in PDM edit page, I want to show the drop down with client names. After the user selected any client name, the second drop down should populate all the release labels of the particular client. Till this I've done. Then I've created couple of textboxes which can be used to insert the value in the PDM table. Here I've a problem. How can I insert a value into the PDM table with the ClientID as per the selected clientname and the release label?
Thanks in advance.
Regards,
Vimal Raj

Hello Vimal,
I think this example will help you:
http://examples.qcu.be/assets/_core/php/examples/basic_qform/listbox.php
Note the $objPerson as the second parameter of AddItem();
This will show you how to interact with the select box.
To insert information see:
http://examples.qcu.be/assets/_core/php/examples/code_generator/save_del...
Let me know if you need a better explanation..
Hi Basilieus,
Thanks for the quick reply. I done in the same way. But I'm getting an error as like as below:
Unable to cast Clientdetails object to string
Exception Type: QInvalidCastException
In the below line:
protected function btnSave_Click($strFormId, $strControlId, $strParameter) {
Line 54:
Line 55: $objClient = Clientdetails::Load(QQ::AndCondition(QQ::Like(QQN::Clientdetails()->ClientName, $this->lstClients->SelectedValue), QQ::Like(QQN::Clientdetails()->ReleaseLabel, $this->lstReleases->SelectedValue)));
Line 56:
Line 57: $valClientID = $objClient->ClientID;
Line 58:
Line 59: $objPDM = new Pdm();
Line 60: $objPDM->BugID = $this->txtBugID->Text;
Obviously you are trying to pass an object as a string.. I don't think you need more SQL to find out the information for Client ID.
This is because your $this->lstClients->SelectedValue is probably an object of the selected "client".
So your $objClient would be this:
$objClient = $this->lstClients->SelectedValue;
And the id would be:
$objClientID = $objClient->ClientId;
Just a guess....