473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

repopulate html select with new database call using JS?

Unfortunately my users are demanding this functionality:
They are on a form. Click on an "add" button. An html window pops up.
They add a new item that is saved to the database. The window closes.
The HTML select box REFRESHES itself with the new informaiton (Primary
key and text field) WITHOUT submitting the form.

I tried to get away with a text box on the form that would dynamically
repopulate the select box, but no-go- they want to follow the above
process exactly with the new window, etc.

What is the easiest and most cross-browser compatible way to run a new
database query and repopulate the select box? It sounds like Ajax to
me, but I'd rather go with a less MS-centric solution.

Feel free to just point me to a cookbook link, I couldn't find one
online

thanks for everything!!!

Don

Jan 13 '06 #1
6 4113
bb*****@gmail.com wrote:
Unfortunately my users are demanding this functionality:
They are on a form. Click on an "add" button. An html window pops up.
They add a new item that is saved to the database. The window closes.
The HTML select box REFRESHES itself with the new informaiton (Primary
key and text field) WITHOUT submitting the form.

I tried to get away with a text box on the form that would dynamically
repopulate the select box, but no-go- they want to follow the above
process exactly with the new window, etc.

What is the easiest and most cross-browser compatible way to run a new
database query and repopulate the select box? It sounds like Ajax to
me, but I'd rather go with a less MS-centric solution.
AJAX isn't MS centric at all, though they were first to introduce
XMLHttpRequest it is now widely implemented in recent browsers (IE 5+,
Mozilla 1.0+, Safari 1.2+, Opera 8, others including Firefox, not sure
when it started supporting it but cetainly since 1.0).

Given your scenario, the best idea is to have the pop-up send data to
the main window, then the main window update the database and return
new values for the select using XMLHttpRequest (aka AJAX), then update
the select.

Don't be tempted to use the pop-up to send the data to the database and
update the select asynchronously - you need to ensure that the database
part worked before updating the select.

There are other techniques that don't use AJAX, e.g. submit a form in a
hidden frame so the user never sees it happen.

Feel free to just point me to a cookbook link, I couldn't find one
online


Try:

<URL:http://www.ajaxtoolbox.com/>

--
Rob
Jan 13 '06 #2
VK

bb*****@gmail.com wrote:
Feel free to just point me to a cookbook link, I couldn't find one
online


<http://www.ajaxtoolbox.com>

Jan 13 '06 #3
> Don't be tempted to use the pop-up to send the data to the database and
update the select asynchronously - you need to ensure that the database
part worked before updating the select.


why not ?

If you do the update in the popup, and everything went fine, I presume
you have a confirmation and a button that says 'OK' or 'CLOSE'.
Delegate a javascript function for the onclick event of the button that
updates the select in the opener.
Or if you close the popup after success, then put the populating
function in the window.onunload and it will work or simply call a
function with the necessary parameters from the opener that does this.

Regards

Jan 13 '06 #4
That is how the structure of my system currently works- The user saw
the ok button and at the click of the ok, I closed the window. then I
wanted to trigger a refresh.

also when I said I was looking for a less MS-centric solution, I
suppose what I meant was, a solution that would require that every
browser in the fleet would be up to date- which I can't control and
comes back to bite me in user testing.

thanks!!!

Don

Jan 13 '06 #5
impaler wrote:
Don't be tempted to use the pop-up to send the data to the database and
update the select asynchronously - you need to ensure that the database
part worked before updating the select.

Who wrote that? Oh, me.

why not ?
Because...

If you do the update in the popup, and everything went fine, I presume
you have a confirmation and a button that says 'OK' or 'CLOSE'.
Delegate a javascript function for the onclick event of the button that
updates the select in the opener.
Or if you close the popup after success, then put the populating
function in the window.onunload and it will work or simply call a
function with the necessary parameters from the opener that does this.


Which is updating the opener synchronously - so you agree with me.

--
Rob
Jan 14 '06 #6
yes, asynchronous updating of the style you mean was not in my plan.

Don

Jan 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
2
by: Christer Alkerud | last post by:
Hi I hope anyone can give me a hint how to continue I have an ASP page containing 3 list boxes. When the page is opened the list boxes are populated with some default values from a...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
1
by: Benny | last post by:
I need to populate a table with information then in a seperate utility, in the same application, pull that data using the same criteria that was first used and update some values, unique to an id,...
14
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
5
by: Hamayun Khan | last post by:
Hi Basically I m PHP developer but Now i have project in asp.net 2005. I m new to ASP.NET 2005. Even I have no experience of the earlier versions of asp.net. At this point I need some help for...
2
by: joecosmides | last post by:
I have a microsoft access front end and backend database for multi- user use. I have the back end located on a server that also is an IIS webserver. I've created a few ASP pages that pull customer...
0
by: studentofknowledge | last post by:
hi my knowledgeable comrads I have created a web form using html, css with the addition of some basic javascript validation. Although now im having trouble to insert this information to my local...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.