Solved

Clicking on a value from one form to enter in another

Posted on 2008-06-12
4
226 Views
Last Modified: 2012-05-05
I would like to get a little assistance with something. I have a web page that allows a user to enter a new record in a database....and that works fine. But the user is typing in the name of the location for a specific record....so the first user may enter "Frederick Village" for the location. Then a second user creating a different record for the same location may enter the location name differently, like misspell the location, and then I have two different location names representing the same thing. I have another table in my database that lists all of the locations that we deal with...over 1000 names. Rather that have a drop down form where the user has to scroll through 1000 names to find the one they want, I'd like to have a button that the user selects, and then a pop-up box with a list of the locations. I wanted to break that list into regions on the popup box to streamline the location names based on region, which I think I can do. What I need help with though is what do I need to do to be able to have the user select the location name from the popup box, and then that selected name gets entered in the initial web page form where they were tyoing in the location name to enter a new record?? Any help would be greatly appreciated!!!
0
Comment
Question by:diecasthft
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
Gurunathans earned 500 total points
ID: 21773015
Hello Member,
In the Main Web Page where the user enters the Location use the following Javascript:
function NewWindow(mypage, myname, w, h, scroll)
{
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=false';
win = window.open(mypage, myname, winprops);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
Call this Javascript function from the Click_Event of the Location Text Box like so:

<input type="text" name="input_action_requirement" id="input_action_requirement"
onfocus="javascript:blur();" onclick="javascript:NewWindow('POPUP_WINDOW.htm', 'User_Input', 350, 320, 'no', 'XYZ')">
IN THE POPUP_WINDOW.htm :
Use this Javascript for the Click Event of the Submit Button:
function sendData()
{
self.opener.document.forms["Form_RequestAccess"].input_action_requirement.value = document.forms["form1"].txtUserEntry.value;
window.self.close();
}
SUBMIT BUTTON CODE:
<form name="form1" id="form1">
<input type="text" name="txtUserEntry">
<input type="Button" value="Submit" onclick="javascript:sendData()" name="input_submit" ID="Button1">

If this Doesnot work I can suggest you a more elagant solution but not this easy.
I am attaching some Test Files in the next submission.

0
 
LVL 1

Expert Comment

by:Gurunathans
ID: 21773188
Hello Member,

Find Test Files attached. Copy them both to the same Folder and test them. Change the extension of these files from .txt to .htm.

MainPage.zip
0
 

Author Comment

by:diecasthft
ID: 21796489
That did it!!! I was able to add some radio buttons for the different regions to refine the query a little more and put in db querys to load a drop down box, then taking your example to pass the selection to the main page. Thanks Alot!!!!!
0
 

Author Closing Comment

by:diecasthft
ID: 31466657
Thanks Alot!!!!! I greatly appreciate it!!!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
,IIS, Asp.net login and LocalSQLServer 3 80
How to Transfer large json from server to browser part by part 2 84
Compare site how does it work 4 77
Animated .jpg? 13 80
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question