Index: bug_report_advanced_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_report_advanced_page.php,v
retrieving revision 1.31
diff -u -r1.31 bug_report_advanced_page.php
--- bug_report_advanced_page.php	11 Jan 2004 07:16:06 -0000	1.31
+++ bug_report_advanced_page.php	28 Feb 2004 22:02:46 -0000
@@ -300,6 +300,7 @@
 <!-- Custom Fields -->
 <?php
 	$t_custom_fields_found = false;
+	$custom_fields_count = 0;
 	$t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );
 
 	foreach( $t_related_custom_field_ids as $t_id ) {
@@ -308,6 +309,7 @@
 		}
 
 		$t_custom_fields_found = true;
+		$custom_fields_count++;
 		$t_def = custom_field_get_definition( $t_id );
 ?>
 <tr <?php echo helper_alternate_class() ?>>
@@ -315,7 +317,7 @@
 		<?php echo lang_get_defaulted( $t_def['name'] ) ?>
 	</td>
 	<td>
-		<?php print_custom_field_input( $t_def ) ?>
+		<?php print_custom_field_input( $t_def, null, $custom_fields_count+15 ) ?>
 	</td>
 </tr>
 <?php
@@ -339,7 +341,7 @@
 	</td>
 	<td>
 		<input type="hidden" name="max_file_size" value="<?php echo config_get( 'max_file_size' ) ?>" />
-		<input tabindex="16" name="file" type="file" size="60" />
+		<input tabindex="<?php echo $custom_fields_count+16 ?>" name="file" type="file" size="60" />
 	</td>
 </tr>
 <?php } ?>
@@ -351,8 +353,8 @@
 		<?php echo lang_get( 'view_status' ) ?>
 	</td>
 	<td>
-		<input tabindex="17" type="radio" name="view_state" value="<?php echo VS_PUBLIC ?>" <?php check_checked( $f_view_state, VS_PUBLIC ) ?> /> <?php echo lang_get( 'public' ) ?>
-		<input tabindex="18" type="radio" name="view_state" value="<?php echo VS_PRIVATE ?>" <?php check_checked( $f_view_state, VS_PRIVATE ) ?> /> <?php echo lang_get( 'private' ) ?>
+		<input tabindex="<?php echo $custom_fields_count+17>" type="radio" name="view_state" value="<?php echo VS_PUBLIC ?>" <?php check_checked( $f_view_state, VS_PUBLIC ) ?> /> <?php echo lang_get( 'public' ) ?>
+		<input tabindex="<?php echo $custom_fields_count+18>" type="radio" name="view_state" value="<?php echo VS_PRIVATE ?>" <?php check_checked( $f_view_state, VS_PRIVATE ) ?> /> <?php echo lang_get( 'private' ) ?>
 	</td>
 </tr>
 
@@ -363,7 +365,7 @@
 		<?php echo lang_get( 'report_stay' ) ?> <?php print_documentation_link( 'report_stay' ) ?>
 	</td>
 	<td>
-		<input tabindex="19" type="checkbox" name="report_stay" <?php check_checked( $f_report_stay ) ?> /> (<?php echo lang_get( 'check_report_more_bugs' ) ?>)
+		<input tabindex="<?php echo $custom_fields_count+19 ?>" type="checkbox" name="report_stay" <?php check_checked( $f_report_stay ) ?> /> (<?php echo lang_get( 'check_report_more_bugs' ) ?>)
 	</td>
 </tr>
 
@@ -374,7 +376,7 @@
 		<span class="required"> * <?php echo lang_get( 'required' ) ?></span>
 	</td>
 	<td class="center">
-		<input tabindex="20" type="submit" value="<?php echo lang_get( 'submit_report_button' ) ?>" />
+		<input tabindex="<?php echo $custom_fields_count+20 ?>" type="submit" value="<?php echo lang_get( 'submit_report_button' ) ?>" />
 	</td>
 </tr>
 
Index: bug_report_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_report_page.php,v
retrieving revision 1.31
diff -u -r1.31 bug_report_page.php
--- bug_report_page.php	5 Feb 2004 10:57:01 -0000	1.31
+++ bug_report_page.php	28 Feb 2004 22:02:46 -0000
@@ -173,19 +173,21 @@
 <!-- Custom Fields -->
 <?php
 	$t_custom_fields_found = false;
+	$custom_fields_count = 0;
 	$t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );
 
 	foreach( $t_related_custom_field_ids as $t_id ) {
 		$t_def = custom_field_get_definition( $t_id );
 		if( !$t_def['advanced'] && custom_field_has_write_access_to_project( $t_id, $t_project_id ) ) {
 			$t_custom_fields_found = true;
+			$custom_fields_count++;
 ?>
 <tr <?php echo helper_alternate_class() ?>>
 	<td class="category">
 		<?php echo lang_get_defaulted( $t_def['name'] ) ?>
 	</td>
 	<td>
-		<?php print_custom_field_input( $t_def ) ?>
+		<?php print_custom_field_input( $t_def, null, $custom_fields_count+7 ) ?>
 	</td>
 </tr>
 <?php
@@ -210,7 +212,7 @@
 	</td>
 	<td>
 		<input type="hidden" name="max_file_size" value="<?php echo config_get( 'max_file_size' ) ?>" />
-		<input tabindex="8" name="file" type="file" size="60" />
+		<input tabindex="<?php echo $custom_fields_count+8 ?>" name="file" type="file" size="60" />
 	</td>
 </tr>
 <?php } ?>
@@ -222,8 +224,8 @@
 		<?php echo lang_get( 'view_status' ) ?>
 	</td>
 	<td>
-		<input tabindex="9" type="radio" name="view_state" value="<?php echo VS_PUBLIC ?>" <?php check_checked( $f_view_state, VS_PUBLIC ) ?> /> <?php echo lang_get( 'public' ) ?>
-		<input tabindex="10" type="radio" name="view_state" value="<?php echo VS_PRIVATE ?>" <?php check_checked( $f_view_state, VS_PRIVATE ) ?> /> <?php echo lang_get( 'private' ) ?>
+		<input tabindex="<?php echo $custom_fields_count+9 ?>" type="radio" name="view_state" value="<?php echo VS_PUBLIC ?>" <?php check_checked( $f_view_state, VS_PUBLIC ) ?> /> <?php echo lang_get( 'public' ) ?>
+		<input tabindex="<?php echo $custom_fields_count+10 ?>" type="radio" name="view_state" value="<?php echo VS_PRIVATE ?>" <?php check_checked( $f_view_state, VS_PRIVATE ) ?> /> <?php echo lang_get( 'private' ) ?>
 	</td>
 </tr>
 
@@ -234,7 +236,7 @@
 		<?php echo lang_get( 'report_stay' ) ?> <?php print_documentation_link( 'report_stay' ) ?>
 	</td>
 	<td>
-		<input tabindex="11" type="checkbox" name="report_stay" <?php check_checked( $f_report_stay ) ?> /> (<?php echo lang_get( 'check_report_more_bugs' ) ?>)
+		<input tabindex="<?php echo $custom_fields_count+11 ?>" type="checkbox" name="report_stay" <?php check_checked( $f_report_stay ) ?> /> (<?php echo lang_get( 'check_report_more_bugs' ) ?>)
 	</td>
 </tr>
 
@@ -245,7 +247,7 @@
 		<span class="required"> * <?php echo lang_get( 'required' ) ?></span>
 	</td>
 	<td class="center">
-		<input tabindex="12" type="submit" value="<?php echo lang_get( 'submit_report_button' ) ?>" />
+		<input tabindex="<?php echo $custom_fields_count+12 ?>" type="submit" value="<?php echo lang_get( 'submit_report_button' ) ?>" />
 	</td>
 </tr>
 
Index: core/custom_field_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/custom_field_api.php,v
retrieving revision 1.24
diff -u -r1.24 custom_field_api.php
--- core/custom_field_api.php	24 Feb 2004 23:51:38 -0000	1.24
+++ core/custom_field_api.php	28 Feb 2004 22:02:46 -0000
@@ -817,8 +817,10 @@
 	# $p_bug_id    contains the bug where this field belongs to. If it's left
 	#              away, it'll default to 0 and thus belongs to a new (i.e.
 	#              non-existant) bug
+	# $p_tabindex  tabindex value to set to the input control. If empty, it is
+	#			   ommitted in the html code.
 	# NOTE: This probably belongs in the print_api.php
-	function print_custom_field_input( $p_field_def, $p_bug_id = null ) {
+	function print_custom_field_input( $p_field_def, $p_bug_id = null, $p_tabindex = null ) {
 		$t_id = $p_field_def['id'];
 
 		if( null == $p_bug_id ) {
@@ -826,12 +828,18 @@
 		} else {
 			$t_custom_field_value = custom_field_get_value( $t_id, $p_bug_id );
 		}
+		
+		if ( null == $p_tabindex ) {
+			$t_tabindex = '';
+		} else {
+			$t_tabindex = " tabindex=\"$p_tabindex\" ";
+		}
 
 		$t_custom_field_value = string_attribute( $t_custom_field_value );
 
 		switch ($p_field_def['type']) {
 		case CUSTOM_FIELD_TYPE_ENUM:
-			echo "<select name=\"custom_field_$t_id\">";
+			echo "<select $t_tabindex name=\"custom_field_$t_id\">";
 			$t_values = explode('|', $p_field_def['possible_values']);
 			foreach( $t_values as $t_option ) {
 				if( $t_custom_field_value == $t_option ) {
@@ -847,7 +855,7 @@
 		case CUSTOM_FIELD_TYPE_EMAIL:
 		default:
 		case CUSTOM_FIELD_TYPE_STRING:
-			echo "<input type=\"text\" name=\"custom_field_$t_id\" size=\"80\"";
+			echo "<input $t_tabindex type=\"text\" name=\"custom_field_$t_id\" size=\"80\"";
 			if( 0 < $p_field_def['length_max'] ) {
 				echo ' maxlength="' . $p_field_def['length_max'] . '"';
 			} else {
