Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flow Logic

Status
Not open for further replies.

ckaspar

IS-IT--Management
Jun 5, 2003
51
US
Basically I have a question regarding the best way to setup this page.

I have a page that a user uses to add a customers name to an Access DB. On that page is a Combo box that is used to input how the customer heard about us. The Combo box is linked to another table in the DB that contains all of the CURRENT referring companies that we have.

From time to time that Combo box does not contain the name of a referrer because they are new due to marketing.

I need a way for the user to add a new referring company to that list so that it will populate both the customer table and the referring company table.

I could place a link on the main page that links to a page for adding to the referring co table but when I navigate back to the customer input page all of the data that was entered before is "gone" because the I had to refresh the page.

What is the best way to have the user be able to input all of the data, including the new referring co, without the user having to re-enter the data that was there prior to them navigating away from the customer page?

Thanks in advance!


Chris Kaspar
Independent Systems and Software
Twin Town Treatment Centers
 
Use an InputBox to enter the new value; thus you never leave the page and can add the new value to your combobox.
 
Then on Submit I can run an if statement that if the input box is not null then run an insert query to update my combo box and then I can then populate the combo box with the new data prior to submitting it to the customer table but after the validation of the existence of the new data?

Chris Kaspar
Independent Systems and Software
Twin Town Treatment Centers
 
Another option is to put the link right next to the dropdown box and have it create a small pop-up window with the form. This is similar enough to the way applications work that I don't think most people would have a problem with using a pop-up in this manner. The advantage of this method is that you don't lose the dta in the current page.
Then to update your original form so that the new value will be in the dropdown you would have a javascript function in "Add" form that would call back to the parent window (original window) with the new dropdown text and value. Something like:
Code:
//function call in submission page of popup form
parent.myFunctionToPassBack('some new item','value for new item')

//back in original form
function myFunctionToPassback(t_text,t_value){
   'create a dropdown option using javascript DOM
   var o = New Option(t_text,t_value);
   var sel = document.getElementsByName("NameOfSelect")[0];
   
   'add the item to the end of the options - since this list is 0 index based we can add it at [/]length[/i] position to put it on the end
   sel.options[sel.options.length] = o;
   'select the item we just added - since we just added an item the length has increased so we want length - 1
   sel.selectedIndex = sel.options.length - 1;
}

This was on the fly, but hopefully correct enough to show the methodology of the javascript call.

The major flow of the page would be something like this:
The original form creates a link to the popup "Add" page if there isn't a valid entry for the user.
Clicking the link opens the popup in a new window.
The "Add" form is filled out by the user and submitted.
The second page of the "Add" form submits the data to the database, then it outputs some javascript to:
1) Check if it has a parent window
2) if it has a parent then send the new entry's text and value back to the parent form and close itself.

The main window gets the new data and adds it to the dropdown, nothing else has changed on the main window so any filled out form data is still there.

The reason I added a step for the child window to check if it has a parent is because this way you can use that form as an independant page or as a popup. If it's an independant form we don't want it mystically closing the only active browser after the user submits some data (if it hapened to me i would think the browser crashed :p )


-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
small suggestion on top of that, some internet users are a little .... shady, in the table where you store referers , you might want to have a T/F field that enables display of the referer, that way someone can't enter a vulgar or offensive referer that would be immediately displayed for all the following customers
 
Tarwn,

I like your idea but I have one question. If the child page adds a new redord to my existing database and then how is the parent page "refreshed" with that new record without refreshing the entire page?

My combo box won't allow me to enter information that does not already exist in the combo box list already.

Or am I missing something?

Chris Kaspar
Independent Systems and Software
Twin Town Treatment Centers
 
If I have understood ur problem correctly,then there is one more option put all the information apart from the referer in Session variables,if the user adds a new referrer u can then show the page with new Combo values plus the older values which are stored in Session varaibles.

 
ckaspar, just out of courtesy for those that use the keyword search, could you possibly post your resolution/solution as well so that others might benefit from it as well.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top