diff --git a/web/pgadmin/static/js/SchemaView/FormView.jsx b/web/pgadmin/static/js/SchemaView/FormView.jsx
index bd2c2064..3d90f03e 100644
--- a/web/pgadmin/static/js/SchemaView/FormView.jsx
+++ b/web/pgadmin/static/js/SchemaView/FormView.jsx
@@ -150,7 +150,7 @@ export default function FormView({
   let tabsClassname = {};
   const [tabValue, setTabValue] = useState(0);
   const classes = useStyles();
-  const firstEleSet = useRef();
+  const firstEleID = useRef();
   const formRef = useRef();
   const onScreenTracker = useRef(false);
   const depListener = useContext(DepListenerContext);
@@ -201,8 +201,6 @@ export default function FormView({
   }, [stateUtils.formResetKey]);
 
   let fullTabs = [];
-  // To check if the first element ref is set.
-  firstEleSet.current = false;
 
   /* Prepare the array of components based on the types */
   schemaRef.current.fields.forEach((field)=>{
@@ -287,13 +285,15 @@ export default function FormView({
         }
 
         const id = field.id || `control${tabs[group].length}`;
-
+        if(visible && !disabled && !firstEleID.current) {
+          firstEleID.current = field.id;
+        }
+        
         tabs[group].push(
           useMemo(()=><MappedFormControl
             inputRef={(ele)=>{
-              if(!firstEleSet.current && ele) {
+              if(firstEleRef && firstEleID.current === field.id) {
                 firstEleRef.current = ele;
-                firstEleSet.current = true;
               }
             }}
             state={value}
diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx
index 09604c00..4deea23f 100644
--- a/web/pgadmin/static/js/components/FormComponents.jsx
+++ b/web/pgadmin/static/js/components/FormComponents.jsx
@@ -559,10 +559,10 @@ InputToggle.propTypes = {
 };
 
 export function FormInputToggle({hasError, required, label,
-  className, helpMessage, testcid, ...props}) {
+  className, helpMessage, testcid, inputRef, ...props}) {
   return (
     <FormInput required={required} label={label} error={hasError} className={className} helpMessage={helpMessage} testcid={testcid}>
-      <InputToggle ref={props.inputRef} {...props}/>
+      <InputToggle ref={inputRef} {...props}/>
     </FormInput>
   );
 }
diff --git a/web/pgadmin/static/js/custom_prop_types.js b/web/pgadmin/static/js/custom_prop_types.js
index d2ce556a..7ec2cda8 100644
--- a/web/pgadmin/static/js/custom_prop_types.js
+++ b/web/pgadmin/static/js/custom_prop_types.js
@@ -14,6 +14,7 @@ const CustomPropTypes = {
   ref: PropTypes.oneOfType([
     PropTypes.func,
     PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
+    PropTypes.object
   ]),
 
   schemaUI: PropTypes.instanceOf(BaseUISchema),
