?
Solved

Clicking on a value from one form to enter in another

Posted on 2008-06-12
4
Medium Priority
?
232 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 2000 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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

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…
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

777 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