How do I avoid automatically selecting the first field in a form?

  • 1
  • 2
  • Question
  • Updated 2 years ago
  • Acknowledged
We have a database of students enrolled in a scholarship program. When someone goes to edit a student record, the first field in the form is a multiple choice field for the student's status (active in high school, graduated, withdrawn, etc.). We wanted the form set so that any employee can change a student from active to graduated, withdrawn, etc. but cannot change an inactive student back to active (if the status is not active, then the field automatically becomes read-only).

Since this is the first field in the form and is automatically selected first, I recently realized that some employees were using the arrow keys to scroll down the page, not realizing that the field was selected, so they would accidentally change the status and be unable to change it back. Does anyone have any tips for how to avoid this? We want that field at the top of the page but don't want employees accidentally editing it when they try to scroll.
Photo of Colin Puckett

Colin Puckett

  • 92 Points 75 badge 2x thumb

Posted 2 years ago

  • 1
  • 2
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
If this is a big issue, 
I'd recommend mixing up your form rules a little, and possibly separating the "inactive" function.  Maybe having a checkbox called 'Inactive?' and then that field is checked, it makes the 'status' field read-only.

(you could make the checkbox read-only too, so you'd have the same security of things not changing after the fact, but it would have to be a deliberate click, and not an accidental scroll)

Maybe add a condition that "the user is not in an administrator role",  so it is only enforced for the lower access levels.

Just some ideas... 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
Another option is to put a very small dummy field as the first field on the form which is a 1 character wide text data entry field led with no label.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,522 Points 20k badge 2x thumb
Use the Image Onload technique with this line of code:

_fid_6.blur ();

OR

_fid_7.focus ();

where fid=6 is the field you don't want to focus on OR fid=7 is the field you do want to focus on.
Photo of Dinesh

Dinesh

  • 464 Points 250 badge 2x thumb
A simple tip would be to add a rule to display a message when the first value is getting changed and adding a radio button.

The radio button can be added to show it in the form only when the value is changed (from active to inactive) to get confirmation from users if they really want to change the first field. The new radio button field can be set to "no" by default.

This way, you are adding one more step to change the value that I believe will avoid accidental change.
Photo of Colin Puckett

Colin Puckett

  • 92 Points 75 badge 2x thumb
Dinesh, just to clarify, you're suggesting I add a new field to show only when the status has been changed to inactive, that would ask the user to confirm whether they meant to change it? There's no way to build yes and no options into the "display a message" rule, is there?

If I have to add a field to the form either way, then I like Matthew's suggestion of having a checkbox before the user can edit the status field, rather than having a confirmation field after. That seems simpler.

Dan, I appreciate the help, but I think using code is too complicated for me.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,522 Points 20k badge 2x thumb
>Dan, I appreciate the help, but I think using code is too complicated for me.

Nonsense. Just create a text formula field named [-] with some HTML allowed with the following formula:
"<img style='display:none' src='' onerror=$('#_fid_6').one('focus',function(){_fid_6.blur();});>"
This assumes fid_6 is the field you want to not be selected when the form opens.

(Edited)