Solved

Clicking on a value from one form to enter in another

Posted on 2008-06-12
4
228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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 learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

735 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