[interchange-cvs] interchange - jon modified code/UserTag/button.tag

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Mar 11 20:21:44 EST 2004


User:      jon
Date:      2004-03-12 01:21:44 GMT
Modified:  code/UserTag button.tag
Log:
Fix bug preventing custom JavaScript from functioning: The the /g regex
substition option was causing all the captured matches to be swallowed up
before the while loop could process them.

Make sure onClick doesn't stick to HTML attribute to its left.

Add a wee bit of documentation on how to use this feature.

Patch supplied by Spencer Christensen <schristensen at backcountrystore.com>.
Thanks, Spencer!

Revision  Changes    Path
1.11      +11 -5     interchange/code/UserTag/button.tag


rev 1.11, prev_rev 1.10
Index: button.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/button.tag,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -u -r1.10 -r1.11
--- button.tag	29 Apr 2003 20:08:26 -0000	1.10
+++ button.tag	12 Mar 2004 01:21:44 -0000	1.11
@@ -2,7 +2,7 @@
 UserTag button addAttr
 UserTag button attrAlias value text
 UserTag button hasEndTag
-UserTag button Version $Id: button.tag,v 1.10 2003/04/29 20:08:26 mheins Exp $
+UserTag button Version $Id: button.tag,v 1.11 2004/03/12 01:21:44 jon Exp $
 UserTag button Documentation <<EOD
 
 =pod
@@ -18,6 +18,12 @@
 	    [perl] # code to delete item [/perl]
     [/button]
 
+You can include arbitrary custom JavaScript like this:
+
+	[button text="Click me"]
+		[javascript]onClick="myOwnOnClickFunction(this);"[/javascript]
+	[/button]
+
 Parameters for this tag are:
 
 =over 4
@@ -76,11 +82,11 @@
              
 =item anchor 
 
-Set to the anchor text value, defaults to TEXT
+Set to the anchor text value, defaults to TEXT.
              
 =item hidetext
 
-Set true if you don't want the anchor displayed
+Set true if you don't want the anchor displayed.
 
 =item extra
 
@@ -138,7 +144,7 @@
 						\]
 							(.*?)
 					  \[ / \1 \]
-					  !!xgis
+					  !!xis
 		)
 	{
 		my $script = $2;
@@ -170,7 +176,7 @@
 
 	if($onclick) {
 		$confirm .= ' && ' if $confirm;
-		$onclick = qq{onClick="$confirm$onclick"};
+		$onclick = qq{ onClick="$confirm$onclick"};
 	}
 
 	# Constructing form button. Will be sent back in all cases,








More information about the interchange-cvs mailing list