I'd like to add some custom javascript to a form. Is it possible? I'm still working on the validation part of the javascript, but here's a live link to what I want to do.
image viewer
All 4 fields will be gravity form fields.
The code is as follows:
<html>
<head>
<title>Image Viewer</title>
<style>
body {color:black;font-family:verdana;font size:12px;}
input { text-transform: uppercase; }
</style>
<script>
function getValues (filename,pos,font) {
var font = document.img.font.value;
filename = filename.replace(/^\s+|\s+$/g, '');
filename = filename.toUpperCase();
var image = 'monograms/'+font+'/'+filename+pos;
return image;
}
function changeImageL(filename,font) {
var filename = getValues(filename,"-L.png",font);
document.mainimageL.src = filename;
}
function changeImageC(filename,font) {
var filename = getValues(filename,"-C.png",font);
document.mainimageC.src = filename;
}
function changeImageR(filename,font) {
var filename = getValues(filename,"-R.png",font);
document.mainimageR.src = filename;
}
</script>
</head>
<body>
<h3 align="center">In-line Image Viewer</h3>
<div align="center">
<form name="img">
<strong>Select a Monogram</strong>
<select name="font">
<option value="Circle">Circle Monogram</option>
<option disabled="disabled" value="Monogram1">Diamond Monogram</option>
<option disabled="disabled" value="Monogram2">Script 1 Monogram</option>
<option disabled="disabled" value="Script">Script 2 Monogram</option>
<option disabled="disabled" value="Serif">Serif Monogram</option>
</select><br /><br />Use All Capital Letters.<br />Press TAB after typing each letter.<br /><br />First Last Middle<br />
<input type="text" name="LL" size="1" maxlength="1" onblur="changeImageL(this.value,font)">
<input type="text" name="CL" size="1" maxlength="1" onblur="changeImageC(this.value,font)">
<input type="text" name="RL" size="1" maxlength="1" onblur="changeImageR(this.value,font)">
</form>
</div>
<div align="center">
<img name="mainimageL" src="monograms/Circle/blank.png" border="0">
<img name="mainimageC" src="monograms/Circle/blankC.png" border="0">
<img name="mainimageR" src="monograms/Circle/blank.png" border="0">
</div>
</body>
</html>
Is it possible to do this, or am I again pushing Gravity Forms past it's limits?
Thanks,
Alisa