473,322 Members | 1,846 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,322 software developers and data experts.

Form field duplication

Hi there,

I wonde if anyone can help me. I have a couple of problems which I am
having trouble resolving. Firstly, I have written a form which includes
field for First Name, Surname and Address, etc I wish to add either a
checkbox or button to enable the user to click and copy details into fields
further down the form to avoid the need to retype. Here is the relevant
section of the form:

<h2>Sample Order Information Form</h2>
<FORM onSubmit="return validateForm(this)" method="post"
action="http://telemat.open.ac.uk/tt281/testform/decode_form.cfm"
name="myForm">
<table cellspacing="0">
<tr>
<td><h3>Shipping Information</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="firstName" maxlength="30"></td>
</tr>
<tr>
<td>Family Name</td>
<td><input type="text" name="familyName"
maxlength="30"></td>
</tr>
<tr>
<td>Contact telephone number</td>
<td><input type="text" name="phoneNumber"
maxlength="30"></td>
</tr>
<tr>
<td>Mobile telephone number</td>
<td><input type="text" name="mobileNumber" maxlength="30"></td>
</tr>
<tr>
<td>Delivery Address</td>
<td>
<textarea name="delivery" rows="8" cols="30">Enter the
delivery address.</textarea></td>
</tr>
<tr>
<td><h3>Billing Information</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="firstName2"
maxlength="30"></td>
</tr>
<tr>
<td>Family Name</td>
<td><input type="text" name="familyName2"
maxlength="30"></td>
</tr>
<tr>
<td>Email address</td>
<td><input type="text" name="emailAddress"
maxlength="30"></td>
</tr>
<tr>
<td>Contact telephone number</td>
<td><input type="text" name="phoneNumber2"
maxlength="30"></td>
</tr>

<tr>
<td>Mobile telephone number</td>
<td><input type="text" name="mobileNumber2" maxlength="30"></td>
</tr>

<tr>
<td>Credit Card Number</td>
<td><input type="text" name="cardNumber"
maxlength="30"></td>
</tr>
<tr>
<td>Credit Card Type</td>
<td>
<input type="radio" value="visa" name="cardType">Visa
<input type="radio" value="mastercard" name="cardType">Mastercard
</td>
</tr>
<tr>
<td>Special Instructions</td>
<td>
<textarea name="instructions" rows="8" cols="30">Enter your
requirements here or comments.</textarea></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
<td><input type="reset"></td>
<td>&nbsp;</td>
</tr>
</table>
</form>

The field I wish to be able to duplicate are First Name, Family Name,
Contact Telephone Number and Mobile Telephone Number. I would like these
field to be duplicated when the user clicks on a button, link of checkbox at
the end of Shipping Information section of the form.

Secondly, I have written a piece of script which produces a wraparound
slideshow, with buttons to move forward and backwards, that allows the user
to view various views of a product. The images used are of varying size and
if I rescale them all to the same size, some images become distorted. If
there a way to produce a box of a specific size into which the images may be
placed, which will remain a constant size, irrespective of the image within,
i.e. one that does not resize to the size of the image within. Here is the
relevant script:<H3>Other images of the sample pan:</H3>
<br>

<FORM NAME="imgForm">

<IMG SRC="images/slideImg0.jpg" HEIGHT="155" WIDTH="250" ALT="Our Vacation
Pix" NAME="slideshow" ALIGN="LEFT" HSPACE="10">
<INPUT TYPE="BUTTON" onClick="newSlide(-1)" VALUE="&laquo; Previous">
<INPUT TYPE="BUTTON" onClick="newSlide(1)" VALUE="Next &raquo;">

<P><TEXTAREA NAME="imgText" ROWS="1" COLS="16" READONLY></TEXTAREA></P><TR>
</FORM>

And this is the function that handles the image and caption cycling:

captionText = new Array("Front View","Optional Glass Lid","Side
Elevation","With Standard Lid"
)

thisImg = 0

imgCt = captionText.length

function newSlide(direction) {

if (document.images) {

thisImg = thisImg + direction

if (thisImg < 0) {

thisImg = imgCt-1
}

if (thisImg == imgCt) {

thisImg = 0
}

document.slideshow.src = "images/slideImg" + thisImg + ".jpg"
document.imgForm.imgText.value = captionText[thisImg]

}

}
Finally, I have been trying to write a function that will check that a name
begins with a capital letter and alerts the user accordingly, using a
regular expression. As an alternative a function that reformats the name
into the correct format would be good.

Any help would be much appreciated. Many thanks in advance.

Steve.


Jul 23 '05 #1
1 1596
Steve Darby wrote:
I have written a form which
includes field for First Name, Surname and Address, etc I wish to
add either a checkbox or button to enable the user to click and copy
details into fields further down the form to avoid the need to
retype.
<input type="checkbox" onclick="var r, i, j, e=form.elements, l=e.length;
for (i=0; i<l; i++) if (e[i].type=='text') {
r=new RegExp('^' + e[i].name + '\\d+$');
for (j=0; j<l; j++) if (r.test(e[j].name) && e[j].type==e[i].type)
e[j].value = checked? e[i].value : '' }"


ciao, dhgm
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris Sharman | last post by:
I'd like to design my pages to work cooperatively with browser autofill features. I've loked around, but can't find any good documentation on supported/unsupported field names...
4
by: Andy Proctor | last post by:
I hope there is an answer out there.... I have a simple database structured like this (non relevant tables and fields omitted) Members table memberID memberFname memberLname memberNokID
21
by: Just Me | last post by:
I've tried in a few places using a variable name Form and it appears to be OK. For example: Public Shared Sub WritePositionsInRegistry(ByVal Form As Form, ByVal SubkeyName As String) Is it OK...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.