Can you use tabindex with &build_select_field?
Dec 27, 2015, 7:04 AM
Enthusiast (661 posts)
Dec 27, 2015, 7:04 AM
Post #3 of 22
Views: 16275
you'll probably need to make a couple of changes.
in html_record_form, you need to add the tab order to the print &build_select_field statements after the fieldname and value.
then in sub build_select_field, you need to retrieve the tab order along with the fieldname and value and add the tabindex code in the output section that is returned to the form.
you can google "tabindex select" for more info about tabindex. upload your code for these subs if you want me to take a look. hope this helps.
in html_record_form, you need to add the tab order to the print &build_select_field statements after the fieldname and value.
then in sub build_select_field, you need to retrieve the tab order along with the fieldname and value and add the tabindex code in the output section that is returned to the form.
you can google "tabindex select" for more info about tabindex. upload your code for these subs if you want me to take a look. hope this helps.
Dec 27, 2015, 10:41 AM
Enthusiast (661 posts)
Dec 27, 2015, 10:41 AM
Post #5 of 22
Views: 16255
because of the modify multi record hack you'll have to make another change to print &build.
example
&build_select_field ("Lead", "$rec{'Lead'}","Lead","33")
then in sub build_select_field
change
my ($column, $value, $name) = @_;
my (@fields, $ouptut);
to
my ($column, $value, $name,$tab) = @_;
my (@fields, $ouptut, $where);
if ($tab) { $where = ' tabindex=' . $tab; }
then change
$output = qq|<SELECT NAME="$name"><OPTION>---|;
to
$output = qq|<SELECT NAME="$name"$where><OPTION>---|;
let me know if this works!
example
&build_select_field ("Lead", "$rec{'Lead'}","Lead","33")
then in sub build_select_field
change
my ($column, $value, $name) = @_;
my (@fields, $ouptut);
to
my ($column, $value, $name,$tab) = @_;
my (@fields, $ouptut, $where);
if ($tab) { $where = ' tabindex=' . $tab; }
then change
$output = qq|<SELECT NAME="$name"><OPTION>---|;
to
$output = qq|<SELECT NAME="$name"$where><OPTION>---|;
let me know if this works!
Dec 27, 2015, 11:46 AM
User (130 posts)
Dec 27, 2015, 11:46 AM
Post #6 of 22
Views: 16265
Works perfectly!
I had to change this:
$output = qq|<SELECT NAME="$name"$where><OPTION>---|;
to
$output = qq|<SELECT NAME="$name","$where"><OPTION>---|;
Which I think you meant to type.
I also forgot about one field I have that uses a multi select field.
I made the changes to this sub, but I think I missed something.
sub build_select_field2 {
# --------------------------------------------------------
# Builds a MULTI SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $size, $tab) = @_;
my (%values,@fields,$field, $where);
if ($tab) { $where = ' tabindex=' . $tab; }
$name || ($name = $column);
@fields = split (/\,/, $db_select_fields{$name});
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
if ($size) {
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
$values{$value}++;
}
if ($size) {
$output = qq|<SELECT NAME="$column" MULTIPLE SIZE=$size><OPTION>---|;
}
else {
$output = qq|<SELECT NAME="$column","$where"><OPTION>---|;
}
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
This is the call in the html.pl
<td rowspan="3" bgcolor="#d1d1c2">|; print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'',6, "Memorabilia","27"); print qq|</td>
Thanks
Ed-
I had to change this:
$output = qq|<SELECT NAME="$name"$where><OPTION>---|;
to
$output = qq|<SELECT NAME="$name","$where"><OPTION>---|;
Which I think you meant to type.
I also forgot about one field I have that uses a multi select field.
I made the changes to this sub, but I think I missed something.
sub build_select_field2 {
# --------------------------------------------------------
# Builds a MULTI SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $size, $tab) = @_;
my (%values,@fields,$field, $where);
if ($tab) { $where = ' tabindex=' . $tab; }
$name || ($name = $column);
@fields = split (/\,/, $db_select_fields{$name});
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
if ($size) {
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
$values{$value}++;
}
if ($size) {
$output = qq|<SELECT NAME="$column" MULTIPLE SIZE=$size><OPTION>---|;
}
else {
$output = qq|<SELECT NAME="$column","$where"><OPTION>---|;
}
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
This is the call in the html.pl
<td rowspan="3" bgcolor="#d1d1c2">|; print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'',6, "Memorabilia","27"); print qq|</td>
Thanks
Ed-
Dec 27, 2015, 12:55 PM
Enthusiast (661 posts)
Dec 27, 2015, 12:55 PM
Post #9 of 22
Views: 16246
i don't know if this is the problem but
print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'',6, "Memorabilia","27");
should be
print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'', "Memorabilia",6,"27");
see sub build_select_field2. the variables are in the following order:
column, value, name, size, tab
if this doesn't fix it, i'm clueless.
print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'',6, "Memorabilia","27");
should be
print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'', "Memorabilia",6,"27");
see sub build_select_field2. the variables are in the following order:
column, value, name, size, tab
if this doesn't fix it, i'm clueless.
Dec 27, 2015, 4:03 PM
User (130 posts)
Dec 27, 2015, 4:03 PM
Post #10 of 22
Views: 16245
Only thing needed to be change was:
print &build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia","27",6);
"Memorabilia","27" went in between the green code. The only thing that is not working correctly is the "6" it tells how many line in the select box is displayed, in this case 6 line, but only 4 line show. But I don't care about that, the rest works!!
Thank you,
Ed-
print &build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia","27",6);
"Memorabilia","27" went in between the green code. The only thing that is not working correctly is the "6" it tells how many line in the select box is displayed, in this case 6 line, but only 4 line show. But I don't care about that, the rest works!!
Thank you,
Ed-
Dec 28, 2015, 10:58 AM
Enthusiast (661 posts)
Dec 28, 2015, 10:58 AM
Post #13 of 22
Views: 16215
i looked at page source and saw this:
<SELECT NAME="Memorabilia[/url]"," tabindex=27"[/url] MULTIPLE SIZE=Memorabilia[/url]>SIZE isn't working because it's set to 'Memorabilia'
tabindex shouldn't be in quotes and the elements in SELECT statement should be separated by spaces instead of comma. i will look at the build routine and tell you how to fix.
edit:
try this so tabindex won't be in quotes by the $tab value is:
change
if ($tab) { $where = ' tabindex=' . $tab; }
to
if ($tab) { $where = qq|tabindex="|;
$where .=$tab;
$where .= qq|"|;
}
then change
<SELECT NAME="$column","$where">
to
<SELECT NAME="$column" $where>
also change the line like the above with MULTIPLE
note there is a space between $column" and $where
please check to be sure the order of the arguments you're passing to the sub build is the same as
my ($column, $value, $name, $size, $tab) = @_;
<SELECT NAME="Memorabilia[/url]"," tabindex=27"[/url] MULTIPLE SIZE=Memorabilia[/url]>SIZE isn't working because it's set to 'Memorabilia'
tabindex shouldn't be in quotes and the elements in SELECT statement should be separated by spaces instead of comma. i will look at the build routine and tell you how to fix.
edit:
try this so tabindex won't be in quotes by the $tab value is:
change
if ($tab) { $where = ' tabindex=' . $tab; }
to
if ($tab) { $where = qq|tabindex="|;
$where .=$tab;
$where .= qq|"|;
}
then change
<SELECT NAME="$column","$where">
to
<SELECT NAME="$column" $where>
also change the line like the above with MULTIPLE
note there is a space between $column" and $where
please check to be sure the order of the arguments you're passing to the sub build is the same as
my ($column, $value, $name, $size, $tab) = @_;
Dec 28, 2015, 1:08 PM
User (130 posts)
Dec 28, 2015, 1:08 PM
Post #14 of 22
Views: 16210
made the changes, stills works the same way.
I changed the code in the html.pl
&build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia","27",6); # This way it works but ignores the 6.
&build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia",6,"27"); # This way it jumps the field and ignores the 6.
And I tried this way and -- well it just did not like this at all.
&build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia",6,27);
sub build_select_field2 {
# --------------------------------------------------------
# Builds a MULTI SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $size, $tab) = @_;
my (%values,@fields,$field, $where);
if ($tab) { $where = qq|tabindex="|;
$where .=$tab;
$where .= qq|"|;
}
$name || ($name = $column);
@fields = split (/\,/, $db_select_fields{$name});
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
if ($size) {
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
$values{$value}++;
}
if ($size) {
$output = qq|<SELECT NAME="$column" $where MULTIPLE SIZE=$size><OPTION>---|;
}
else {
$output = qq|<SELECT NAME="$column" $where><OPTION>---|;
}
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
I changed the code in the html.pl
&build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia","27",6); # This way it works but ignores the 6.
&build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia",6,"27"); # This way it jumps the field and ignores the 6.
And I tried this way and -- well it just did not like this at all.
&build_select_field2("Memorabilia",$in{'Memorabilia'},'',"Memorabilia",6,27);
sub build_select_field2 {
# --------------------------------------------------------
# Builds a MULTI SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $size, $tab) = @_;
my (%values,@fields,$field, $where);
if ($tab) { $where = qq|tabindex="|;
$where .=$tab;
$where .= qq|"|;
}
$name || ($name = $column);
@fields = split (/\,/, $db_select_fields{$name});
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
if ($size) {
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
$values{$value}++;
}
if ($size) {
$output = qq|<SELECT NAME="$column" $where MULTIPLE SIZE=$size><OPTION>---|;
}
else {
$output = qq|<SELECT NAME="$column" $where><OPTION>---|;
}
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
Dec 29, 2015, 12:07 AM
Veteran / Moderator (18436 posts)
Dec 29, 2015, 12:07 AM
Post #17 of 22
Views: 16195
To make it cleaner, this part:
$where .=$tab;
$where .= qq|"|;
}
should be:
Sorry... my OCD kicking in ;)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
if ($tab) { $where = qq|tabindex="|; $where .=$tab;
$where .= qq|"|;
}
should be:
Code:
if ($tab) { $where = qq|tabindex="$tab"|; }Sorry... my OCD kicking in ;)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Dec 29, 2015, 8:12 AM
Veteran / Moderator (18436 posts)
Dec 29, 2015, 8:12 AM
Post #19 of 22
Views: 16167

If you are using:
Code:
qq|xx|or
Code:
q|xx|or even
Code:
q~xx~..then you don't need to worry about quotes :) The only thing to watch out for - is the @ character (as it will try and access that as an array, unless you do \@)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Dec 29, 2015, 11:53 AM
User (130 posts)
Dec 29, 2015, 11:53 AM
Post #20 of 22
Views: 16164
I made these changes. Now it just jumps that field, and just shows 4 line instead of 6 line.
This is what i have:
sub build_select_field2 {
# --------------------------------------------------------
# Builds a MULTI SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $size, $tab) = @_;
my (%values,@fields,$field, $where);
if ($tab) { $where = qq|tabindex="$tab"|; }
$name || ($name = $column);
@fields = split (/\,/, $db_select_fields{$name});
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
if ($size) {
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
$values{$value}++;
}
if ($size) {
$output = qq|<SELECT NAME="$column" $where MULTIPLE SIZE=$size><OPTION>---|;
}
else {
$output = qq|<SELECT NAME="$column" $where><OPTION>---|;
}
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
And the call:
|; print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'',"Memorabilia",6,"27"); print qq|
Thanks-
Ed-
This is what i have:
sub build_select_field2 {
# --------------------------------------------------------
# Builds a MULTI SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $size, $tab) = @_;
my (%values,@fields,$field, $where);
if ($tab) { $where = qq|tabindex="$tab"|; }
$name || ($name = $column);
@fields = split (/\,/, $db_select_fields{$name});
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
if ($size) {
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
$values{$value}++;
}
if ($size) {
$output = qq|<SELECT NAME="$column" $where MULTIPLE SIZE=$size><OPTION>---|;
}
else {
$output = qq|<SELECT NAME="$column" $where><OPTION>---|;
}
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
And the call:
|; print &build_select_field2("Memorabilia",$rec{'Memorabilia'},'',"Memorabilia",6,"27"); print qq|
Thanks-
Ed-
Dec 29, 2015, 12:11 PM
Veteran / Moderator (18436 posts)
Dec 29, 2015, 12:11 PM
Post #21 of 22
Views: 16162
Hi,
Not an ideal solution - but if you don't mind using jQuery, then you could get that to dynamically change the tab index for you:
...then something like this in the outputted HTML:
$(":input").each(function (i) { $(this).attr('tabindex', i + 1); });
});
As I said - not perfect, but easier than trying to debug whats going on :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Not an ideal solution - but if you don't mind using jQuery, then you could get that to dynamically change the tab index for you:
Code:
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>...then something like this in the outputted HTML:
Code:
$(document).ready( function() { $(":input").each(function (i) { $(this).attr('tabindex', i + 1); });
});
As I said - not perfect, but easier than trying to debug whats going on :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!