Closed Thread Icon

Preserved Topic: for the lazy... Pages that link to <a href="https://ozoneasylum.com/backlink?for=18409" title="Pages that link to Preserved Topic: for the lazy..." rel="nofollow" >Preserved Topic: for the lazy...\

 
Author Thread
lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 06-07-2002 09:49

I'm not sure how to force FrontPage to generate JavaScript code to validate my form fields...it does generate FrontPage Extension
(special codes) but not js...how can i get javascript instead?

Or...anyone knows a nice visual tool that help me write/generate javascript form fields generation code?

(i got like more than 20 fields to generate differently!)


oh well,...

lallous

Veneficuz
Paranoid (IV) Inmate

From: A graveyard of dreams
Insane since: Mar 2001

posted posted 06-07-2002 13:26

FrontPage is the work of the Devil! Would probably be easier to write the code by hand, than trying to make FrontPage generate good code.


_________________________
Anyone who has lost track of time when using a computer knows the propensity to dream, the urge to make dreams come true and the tendency to miss lunch.
- copied from the wall of cell 408 -

Hugh
Paranoid (IV) Inmate

From: Dublin, Ireland
Insane since: Jul 2000

posted posted 06-07-2002 16:50

I couldnt agree more with Veneficuz. If you dont know much JS, learn it its not hard, especially to do something simple like that.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 06-08-2002 09:40

no i know JS very well...but i'm just lazy to write if/else/alert/element.focus() 25 times!

i could use FP to generate that code and take that code and paste it in my dreamweaver project and resume my work..

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 06-08-2002 09:59

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

StereoType
Bipolar (III) Inmate

From: the plushdjungle
Insane since: Oct 2001

posted posted 06-09-2002 15:35

I just wrote a little form validator script. It checks just as many form fields as you want.
And it is simple to make it check form fields which aren't called 'text1' and so on. just put the form-field-names in an array like this:
var formnames= new Array("Name","City","Shoesize"...)

and check it like this:

if (eval('document.theform.text'+formnames(i)+'.value')=="")
...
eval('document.theform.text'+formnames(i)+'.style.backgroundColor="white"')

here it is: http://hem.bredband.net/briemi/javascript/formcheck.htm




[This message has been edited by StereoType (edited 06-09-2002).]

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 06-10-2002 11:34

Ini, I've already written something similar !
but sometimes I am even lazy to use it/modify it to fit my new needs!

anyway, here it is:

code:
$_= '
<td align="right" width="242">Name</td>
<td width="407">
<input type="text" name="f_name">
</td>
</tr>
<tr>
<td align="right" width="242">Characteristics:</td>
<td width="407">
<ul>
<li>Age
<input type="text" name="f_age">
<li>Height
<input type="text" name="f_height">
<li>Weight
<input type="text" name="f_weight">
<li>Eyes
<input type="text" name="f_eyes">
<li>Hair
<input type="text" name="f_hair">
<li>Size
<input type="text" name="f_size">
<li>Shoes
<input type="text" name="f_shoes">
<li>Bust
<input type="text" name="f_bust">
<li>Waist
<input type="text" name="f_waist">
<li>Hips
<input type="text" name="f_hips">
<li>Extra
<input type="text" name="f_extra">
</ul>
</td>
</tr>
<tr>
<td align="right" width="242">Small preview image URL:</td>
<td width="407">
<input type="text" name="f_thimgurl" size="50" value="<?=isset($f_id) ? $r[th_imgurl] : uimages/.jpg?>">
</td>
</tr>
<tr>
<td align="right" width="242">Full preview image URL:</td>
<td width="407">
<input type="text" name="f_fullimg" size="50" value="<?=isset($f_id) ? $r[imgurl] : uimages/.jpg?>">
</td>

';

@arr1 = ();
@arr2 = ();
@arr3 = ();
while (/\"(f_([^\"]+))\"/ig)
{
push (@arr1, $1);
push (@arr2, $2);
push (@arr3, "'\$$1'");
}

# make the INSERT string
$insert = "INSERT INTO tablename\n\t(" . join(', ', @arr2) . ")\n\tVALUES (" . join(',', @arr3) . ")\n\n";

# make UPDATE string
$update = "UPDATE tablename SET \n";
for ($i=0;$i<scalar(@arr1);$i++)
{
$update .= "\t@arr2[$i]=@arr3[$i], \n";
}

chop($update); chop($update); chop($update);

$update .= "\n\n";

# make addslashes
$addslashes = "";
for ($i=0;$i < scalar(@arr1); $i++)
{
$addslashes .= "\$@arr1[$i] = addslashes(\$@arr1[$i]);\n";
}
$addslashes .= "\n\n";

# write table contructor

# make form init()
$forminit = "";
for ($i=0;$i < scalar(@arr1);$i++)
{
$forminit .= "f.@arr1[$i].value = \"<?=isset(\$r['@arr2[$i]']) ? \$r['@arr2[$i]'] : ''?>\";\n";
}
$forminit .= "\n";
print $forminit;

open OUTFILE, '>outfile.txt';
print OUTFILE $update;
print OUTFILE $insert;
print OUTFILE $addslashes;
print OUTFILE $forminit;
close OUTFILE;



« BackwardsOnwards »

Show Forum Drop Down Menu