CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Add a new element to a listbox control on the fly using modal window

Print topic Send  topic

Author Message
solesz

Posts: 137
Posted: 01/22/2014, 6:31 AM

The IDE is CCS4.3.00.7676, however the solution can be for any version over that.

I have a form - binded to a DB_table_1 with a lot of controls, including a listbox (which loads data from DB_table_2), holding the list of the currently recorded Partners of a company.

I want to implement a "Add partner on the fly" solution when during editing the form the user can add a new Partner to the list without leaving the page.

Step 1: I create a modal window, where basic partner data can be recorded into DB table_2. DONE, Ok.
Step 2: Update the listbox control only with the new partner list.

(remark: If I put the whole form into update panel, when it refreshed it clears data from all control, because simple reloading.)

Is there a way to put only one element within a form into an update panel ? - I guess no...
Is there a good solution - probably custom javascript which is doing this job simple and quick?

Any good ideas?

solesz
View profile  Send private message
osulywan


Posts: 16
Posted: 01/30/2014, 10:38 AM

I did something similar but with a pop-up search window. My listbox of products was getting too big so I built a searchable grid. It does not change the values in the list but changes what is selected in the parent window.

function returnValue(row)

{

var currparam = window.location.search;
var start;
var end;
var parentRow = '';

start = currparam.indexOf('row=');
if (start!=-1) {
start = start+4;
end = currparam.indexOf('&',start);
if (end == -1) {
end = currparam.length;
}
parentRow = currparam.substr(start,end-start);
}

var myVal = document.getElementById("productsproduct_id_"+row).value;

window.opener.updateValue(parentRow,myVal);

window.close();

return false;

}
In the pop-up there is an onclick="returnValue({products:rowNumber})" (the parent is a grid hence the parentRow is passed in the URL). In the parent window I have 2 functions:

function selectValue(row)
{
// open popup window and pass field id
window.open('product_search.php?row=' + encodeURIComponent(row),'popuppage',
'width=500,toolbar=0,resizable=1,scrollbars=yes,height=650,top=100,left=100');
}

function updateValue(row, value)
{
// this gets called from the popup window and updates the field with a new value
var selectedProduct = document.getElementById("order_itemsproduct_id_"+row);
for (var i = 0; i < selectedProduct.length; i++) {
if (selectedProduct.options.selected == true) {
selectedProduct.options.selected = false;
}
if (selectedProduct.options.value == value) {
selectedProduct.options.selected = true;
}
}
}

Maybe you can use this to change the values in the list instead of just what was selected.
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.