Home : Visit Our Store : Latest Specials : Recommend Us
Contact Us :
Support Forum : Multiple Domain Discount
 
"Grab" Form Field Text Tutorial
Go to www.cgiscript.net for more free tools!

Description:
Use these instructions to create a 'grab text' option adjacent to your textarea within your forms. You can use any of the 3 options, link, button, or image. See the example in the form below.
Directions:
Use these instructions to create a 'grab text' option adjacent to your textarea within your forms. You can use any of the 3 options, link, button, or image. See the example in the form below.

Step 1:

The first thing you need to do is setup some JavaScript in the HEAD of your HTML document that will do the 'grabbing'. The function will take whatever form field is passed and set the focus to it then select the text within it.

<SCRIPT LANGUAGE='JavaScript'>
<!--
function aceGrabText(fieldName){
fieldName.focus();
fieldName.select();
}
-->
</SCRIPT>

Step 2:

The second thing you need to do is setup the link that will pass the form field data to the JavaScript. It is important to follow this step carefully. You can see in the example link below the JavaScript call javascript:aceGrabText(document.form1.field1). The important part of this call is the "form1" and the "field1" values. These actually tell the JavaScript what form and field will be "grabbed". The textarea resides in a form, type the form name in place of the "form1" name below. Then the textarea itself has a name, type that in place of the "field1" name.

Note: You can add as many links as you want, as many forms and textarea fields you have. Simply change the form name and field name accordingly. They all share the same JavaScript function.

<a href="javascript:aceGrabText(document.form1.field1)">Click to Select</a>

EXAMPLE FORM:
<form name="
form1">
<textarea rows="12" cols="62" name="
field1
">Text goes here.</textarea>
</form>

Paste the code between the open and close HEAD tags within your document:

Step 1 - Action:

Then use Control-C to copy the text into your web page.

Step 2 - Action

Choose from any of the 3 options, link text, button, or image link. Paste the code between the open and close BODY tags within your document where you want the "grab text" link to appear:

Link Text Option

Then use Control-C to copy the text into your web page.

Button Option

Then use Control-C to copy the text into your web page.

Image Option

Then use Control-C to copy the text into your web page.


Home
| Recommend Us | Contact Us
Copyright ©  WWW.CGISCRIPT.NET, LLC.