Archive for October, 2004

Menu Swapper

Friday, October 8th, 2004

I was just browsing through some of the other form-related scripts on javscript source. I’m sure I’ve linked to this in the past, but these types of widgets come up a lot in the work I do. I usually just avoid them, but it would probably be a lot easier for people if I actually used the javascript to “simulate” how the application I’m designing for will work. So it’s worthy of another link (at least to me) :)

Javascript Forms: Menu Swapper
Move selected items from one list box to another list box.

Copy values from one field to another with javascript

Friday, October 8th, 2004

Needed to write a javascript that would take the values of one select box - and copy it to all the other select boxes on the same page. I found this script which will take all the values from one set of fields - and copy it to another set of fields (kind of like those billing / shipping forms, where if your billing and shipping address is the same, you just check a box - and it prefills the other set of fields for you with the same info from above). And while it “inspired me” - it wasn’t exactly what I was looking for. In my case - I didn’t know the exact names of all the other fields, and I didn’t even know how many of them there would be - they are generated dynamically. It’s a pretty simple script, but here it is anyway:

<script type=”text/javascript”>
function applyToAll()
{
for (var i=0; i< document.YOURFORMNAME.length; i++) {
document.YOURFORMNAME[i].selectedIndex = document.YOURFORMNAME.NAMEOFMAINSELECT.selectedIndex;
}
}
</script>

So your select box probably looks like this:

<select name=”NAMEOFMAINSELECT”>
<option value=”1″>1</option>
<option value=”2″>2</option>
… etc. …
</select>

and then, next to the select box (which will be the one all the others are based on) put a link like this:

<a href=”javascript:applyToAll()”>Apply To All</a>

Restrict Access based on User Level on a per-post basis

Thursday, October 7th, 2004

Christine was asking about this, and I pointed her to this post - which points to this post. But looking through the comments, apparently there’s a simple plugin which will do the trick:

ViewLevel Plugin for WordPress 1.2

Dynamic Table Sorting with Javascript

Thursday, October 7th, 2004

Just saw this on del.icio.us:

BrainJar: Table Sort (using javascript)
Click on the header cell, and it will re-sort the data accordingly. Click it again, and it will reverse the sorting. That is just so cool. :) Check out the demo.

Uberlink CSS Rollover Tutorial

Thursday, October 7th, 2004

Uberlink CSS Rollover Tutorial
[via (an old post on) Simon Willison]

Public Service Announcement: WordPress 1.2.1

Wednesday, October 6th, 2004

Wordpress 1.2.1 is now available - bug and security fixes. details here.

Get it while it’s hot!

Flash Email

Wednesday, October 6th, 2004

I’m starting to get asked about Flash emails (sigh) so just trying to collect a few links that may be helpful

ActionScript Tutorials - send a flash (HTML) email via PHP

(I’ll add more if/when I find them)

ASP: get the name of the current page

Tuesday, October 5th, 2004

(Side note: I hate ASP. I love PHP. But sometimes mean people make me use ASP) ;o)

I needed to get the current page name and redirect to a different page if it was a certain name. (ie. 1.asp or 2.asp or… up to any two-digit + .asp)

First - to get the page name I used a script I found here:

Dim strURL, aryURL, pagename, objRegExp
strURL = Request.ServerVariables(”SCRIPT_NAME”)
aryURL = Split(strURL, “/”, -1, 1)
pagename = aryURL(ubound(aryURL))

Then I check the page against a reg exp:

set objRegExp = new RegExp
objRegExp.Pattern = “^[0-9]{1,2}\.asp”
if objRegExp.Test(pagename) then
Response.Redirect(”http://www.example.com/pageToRedirectTo.asp”)
end if

(FYI - I’m trying to get a better grasp of regular expressions. I know they’re useful, I just can’t seem to wrap my head around them. We’re still at the “it makes my eyes bleed” stage - which is also pretty much how I feel about ASP)

Javascripts

Tuesday, October 5th, 2004

Someone had emailed me asking for a script that would keep the navigation “with you” as you scrolled down the page. I know I’ve seen these things many places (although I will add that, while somewhat convenient, I find these menus distracting from the content of the site)

I did find it, but thought it might be worthwhile to post the places I told him to search around in as well:
hotscripts.com
javascript.com
scriptsearch.com
dhtmlcentral.com
dynamicdrive.com

At the last one is where I found the script.

Form Processing

Monday, October 4th, 2004

Living on del.icio.us this morning. Some more finds:

Phorm: PHP form processing
Can include form data in an acknowledgement page, email it to one or more addresses, validate it, includ it in an autoresponder message, lot it to a text file or mySQL database.

Also available is a “jr.” version:
Phorm Jr is as stated on the site: … smaller and simpler, making it easier to install and configure. If all you need is to acknowledge your visitors and email the form data to yourself, then Phorm Jr. is perfect for you.