[interchange-cvs] interchange - heins modified code/Widget/country_select.widget

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Aug 2 14:10:30 EDT 2006


User:      heins
Date:      2006-08-02 18:10:30 GMT
Modified:  code/Widget country_select.widget
Log:
* Add state-size and state-extra parameters to allow some extra control
  of the state text box in the country-select widget* This box is
  generated in the country-select portion, so must be passed there.

    [display
                name=state
                type=state_select
                value="[value state]"
                comment="See country_select widget for other related parameters"
            ]

	 [display name=country type=country_select
                state-size="3"
                state-extra="maxlength=3"
                value="[value country]"]

Revision  Changes    Path
1.9       +6 -3      interchange/code/Widget/country_select.widget


rev 1.9, prev_rev 1.8
Index: country_select.widget
===================================================================
RCS file: /var/cvs/interchange/code/Widget/country_select.widget,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- country_select.widget	11 Sep 2005 23:46:39 -0000	1.8
+++ country_select.widget	2 Aug 2006 18:10:29 -0000	1.9
@@ -1,6 +1,6 @@
 # Copyright 2005 Interchange Development Group (http://www.icdevgroup.org/)
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: country_select.widget,v 1.8 2005/09/11 23:46:39 docelic Exp $
+# $Id: country_select.widget,v 1.9 2006/08/02 18:10:29 mheins Exp $
 
 CodeDef state_select  Widget  1
 CodeDef state_select  Description State (needs country_select)
@@ -60,7 +60,7 @@
 
 	my $svar = $opt->{state_var} || $opt->{state_variable} || "${pre}state";
 	my $svar_in = $svar . '_cs_in';
-	my $size = $opt->{cols} || $opt->{width} || '16';
+	my $size = $opt->{state_size} || $opt->{cols} || $opt->{width} || '16';
 	my $ctab = $opt->{country_table} || 'country';
 	$opt->{state_style} ||= 'font-style: italic; font-size: smaller';
 
@@ -190,6 +190,9 @@
 
 	my $cvar = $opt->{name};
 	$cvar =~ s/\W+/_/g;
+
+	my $extra = $opt->{state_extra} ? " $opt->{state_extra}" : '';
+
 	push @pre, <<EOF;
 	function ${cvar}_widget_adjust_state (cel,sval) {
 		var sbox = document.getElementById('$sel');
@@ -214,7 +217,7 @@
 		var svary = $v_state_vary\[country];
 		if(! svary) {
 			var val = '';
-			sbox.innerHTML = '<input type="text" size="$size" name="$svar_in" value="' + sval + '" onChange="$v_formv.$svar.value = this.value">';
+			sbox.innerHTML = '<input type="text" size="$size" name="$svar_in" value="' + sval + '" onChange="$v_formv.$svar.value = this.value"$extra>';
 			$v_formv.$svar.value=sval;
 
 			return;








More information about the interchange-cvs mailing list