473,796 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatically input ref. no. into contact form input box on clicking a button

3 New Member
Hi there,

I'm new to javascript and am looking for a solution to my problem, I am creating a site for a property company and they want a enquire button next to each property and when clicked it goes to the contact form I have created where it automatically inputs the property ref number in the ref no. input box.

Can anyone please help me on the code for this?

Cheers TJ.
Mar 12 '08 #1
6 1163
gits
5,390 Recognized Expert Moderator Expert
could you tell whether the contact form opens in a popup or replaces the current page? could you post an example code?

kind regards
Mar 12 '08 #2
tamjames75
3 New Member
The form replaces the current window, I haven't attached any properties yet but have created the form at this address:

http://properties.barg afinance.co.uk/contact/

TJ
Mar 13 '08 #3
gits
5,390 Recognized Expert Moderator Expert
so you could pass it with a query-string:

Expand|Select|Wrap|Line Numbers
  1. http://properties.bargafinance.co.uk/contact/form.html?ref_id=123456
now in your form you could retrieve this with:

Expand|Select|Wrap|Line Numbers
  1. var query_string = window.location.search;
kind regards
Mar 13 '08 #4
tamjames75
3 New Member
Thanks for your help, but how could I get that to appear in the input box what code would I need to put on that?

I have entered my link as in what you said but on the form how does it know to appear in that input box?

Cheers.
Mar 13 '08 #5
gits
5,390 Recognized Expert Moderator Expert
use the onload of your formpage to call a function like the following:

Expand|Select|Wrap|Line Numbers
  1. function get_ref_id() {
  2.     var qs = window.location.search;
  3.     var ref_id = qs.match(/([^=]+$)/)[1];
  4.     var node = document.getElementById('your_element_id');
  5.  
  6.     node.value = ref_id;
  7. }
  8.  
kind regards
Mar 13 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
Changed the thread title. Please remember to Use a Good Thread Title. Thanks!
Mar 14 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7721
by: Pete Wilson | last post by:
How can I highlight the <input type="submit"> object that I want to highlight? 1. In my form, the user enters his ID. He sees two submit "buttons," left labeled Cancel, the right labeled Signup. 2. If he enters his ID and selects the Signup button with his mouse, all is well. 3. But if he enters his ID and then hits the Enter key, then the
3
2823
by: chuck | last post by:
Hi, This is a test for a larger form i am working on. I want to have a real time display of the radio button value when selected. I tried with various event handlers with varying success. The code below works in mac/win firefox, other browsers don't handle it at all. I have tried using onclick, and that buggers it in all browsers. <script type="text/javascript"> function updateSize()
1
1252
by: Moch | last post by:
I have the following problem. I have two tables that are related. One tabel is contacts and the other is projects. Both tables are filled via a form. On the contacts-form i have a button "add project". Then the project forms opens so i can fill in the data for this specific project. But in the project form i always have to choose to wich contact the projects belong.
1
2818
by: KenLee | last post by:
I worked on Windows application. I made a application to covert flat file to insert database. currently, I made a button to display progress bar after clicking the button. I just want to load automatically after clicking application.exe file without clicking the button on the form loaded. is there any way to load form and start automatically without clicking any button?
1
3502
by: namanhvu | last post by:
Hi everyone, I'm trying to create a form where the radio button is automatically selected when the input text field beside it is clicked. I know I need to use "onClick" somewhere but I don't know how. With links I found it it would work like this: <SCRIPT LANGUAGE="JavaScript"> function click(which) {
2
3110
by: Cranky | last post by:
Ok, here is my scenario: I need to input numbers using my handheld IPAQ. I figured out how to create an online numeric keypad for inputting numbers into an input field, what I need to know is how I can have JS switch from one input field to another based on me clicking in the empty box. Here is my code: ########## Start of code ################### <html> <head>
1
4008
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. Depends on the pull down list selection, I use script.aculo.us to validate the user input before submit and pass the necessary data, such as contact type, contact information and ranking to a php program for updating. This form should allow multiple...
5
2300
by: The Devil | last post by:
Hi, This is not just a simple input form made with javascript. This is the code: <html><head> <script language="JavaScript"> var i=0; function add(inputEvent, inputDur, inputCode, placeEvent, placeDur, placeCode, placeDel, elmnt, inputButton) {
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.