Solved

Clicking on a value from one form to enter in another

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

920 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

13 Experts available now in Live!

Get 1:1 Help Now