Solved

Clicking on a value from one form to enter in another

Posted on 2008-06-12
4
224 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logiā€¦
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now