473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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 1145
gits
5,390 Expert Mod 4TB
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
The form replaces the current window, I haven't attached any properties yet but have created the form at this address:

http://properties.bargafinance.co.uk/contact/

TJ
Mar 13 '08 #3
gits
5,390 Expert Mod 4TB
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
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 Expert Mod 4TB
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 Expert Mod 8TB
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
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....
3
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...
1
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...
1
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...
1
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...
2
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...
1
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. ...
5
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,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.