View Full Version : simple script question
Benson
03-07-1999, 04:49 PM
I'm customizing a mailing list perl script for quicker usage..
In the following, how can I put default values in the script? I want to make some radio buttons checked by default and put some text in the text boxes..
[quote]
print "Subject: <input type=\"text\" name=\"subject\" size=40>
\n";
print "Use salutation?
\n";
print "<input type=\"radio\" name=\"usename\" value=\"yes\">Yes\n";
print "<input type=\"radio\" name=\"usename\" value=\"no\">No
\n";
print "Of the form:
\n";
print "<input type=\"text\" name=\"beforename\" size=20>\n";
print "NAME\n";
print "<input type=\"text\" name=\"aftername\" size=20>
\n";
[\quote]
------------------
ICQ#8418658-alba gu brath!
For type=Text areas add Value="Whatever You Want"
This will make the Value= the dafault
To have a radio button checked
type=radio CHECKED name="....
http://www.aota.net/ubb/wink.gif
Deb
Benson
03-07-1999, 05:32 PM
Thanks Deb, works great - though it took me a couple of minutes to realize that some "\" were needed to precede the quotation marks in the value fields..
cheers
ChrisH
03-08-1999, 08:54 PM
You can use qq in perl to avoid all
this quoting, too. For example,
print "value=\"true\"";
print qq!value="true"!;
print qq/value="true"/;
are all the same. The qq uses the
next character instead of the "
character. Handy for cases like this.
ch
Benson
03-08-1999, 09:28 PM
aha..ok thanks. Perl and I aren't on a first name basis, exactly!
Justin
03-08-1999, 09:34 PM
A side note about HTML - you don't have to quote all of the values. The general rule is if there is white space in a value, quote it, otherwise you don't have to.
print "Subject: <input type=text name=subject size=40>
\n";
print "<input type=radio name=username value=yes>Yes\n";
And so on. I only qupte URL's or whitespace, and all browsers I've used accept it just fine. And if I'm not mistaken, the browser can actually render numbers (even colors) quicker when not quoted, because they must be converted from a literal string into a value - but that's a whole different issue http://www.aota.net/ubb/smile.gif
Also, you can do this:
print <<End;
Subject: <input type=text name=subject size=40>
blah blah blah
"blah"
etc
End
That will work and eliminate having to escape quotes, type new lines, and semicolons. Also makes for nicer formatting in your code, too http://www.aota.net/ubb/smile.gif
------------------
Justin Nelson, SFE Software
www.vdj.net (http://www.vdj.net)
Terra
03-08-1999, 09:55 PM
I agree with Justin, HERE docs rock!
Nothing worse than having carefully crafted Perl code, mucked up by all that gui (gooey) html stuff...
Deb, keep yer mits off my code! http://www.aota.net/ubb/biggrin.gif
--
Terra
--Deb, it's a $16.00 fine for dipping your hands in the cookie jar--
FutureQuest
Thanks a lot JUSTIN! Now ya got me in trouble:P
Benson
03-09-1999, 01:52 AM
[Ucode]print <<End;
Subject: <input type=text name=subject size=40>
blah blah blah
"blah"
etc
End[/quote]
This works well 8)
[This message has been edited by Benson (edited 03-09-99).]
Benson
03-09-1999, 01:54 AM
Something doesn't look quite right ^^
http://www.aota.net/ubb/redface.gif
------------------
I'd rather have a bottle in front
of me than a frontal lobotomy
Benson,
I think it's Ted's poor HTML coding that messes up the code markup tag. He has a <pre> tag, but no </pre>, so it continues on even after the code segment is done, sometimes on to the next post...
Del
Benson
03-09-1999, 02:42 AM
Humpf! I think Fq ought to get a refund on this month's "rent" of UBB!! Wonder what the chances of THAT is?!
Justin
03-09-1999, 03:09 AM
I personally hate the <pre> tag because of how small it makes the font. They could at least bump it up a bit... I added the [code] tag to mine and it just changes the font to Arial and blockquotes it http://www.aota.net/ubb/smile.gif Among other things...
I assume editing it fixes it... I've seen this twice and have yet to see the problem. Oh, well. I'll live http://www.aota.net/ubb/biggrin.gif
<edit>
I guess I deserve to leave the mistake - I meant Courier http://www.aota.net/ubb/smile.gif
</edit>
------------------
Justin Nelson, SFE Software
www.vdj.net (http://www.vdj.net)
[This message has been edited by Justin (edited 03-09-99).]
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.