Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to access to input inside InputGroup BlueprintJs react component

The BluePrintJS React InputGroup component is great and convenient for modern user-interface. But unfortunately the React component do not allow access to the <input> element inside.

I need to access the input element for 2 main reasons :

  • if I have 50 InputGroups in my form, I don't want to write 50 OnChange() callbacks. When the user finishes all inputs, I want to get all InputGroup.value(), which is not possible (it is possible with regular input element thanks to HTMLInputElement.value, but InputGroup does not allow accessing internal input)

  • At form displaying, I need to focus on first field. InputGroup has no function focus(), while HTMLInputElement has one.

Briefly there are 2 functions missing in InputGroup : GetValue() and Focus() , and I cannot see why they are missing. Any suggestion will be greatly appreciated. Thanks a lot.

like image 330
Riccardo Cohen Avatar asked Mar 20 '26 15:03

Riccardo Cohen


1 Answers

I found the way of getting the input ! with :

inputRef={(input:HTMLInputElement) => {
    this.logininput=input;
}}

(didn't see it at first time).

Now I have the input object, I can set focus at "didmount", and I can get the value with logininput.value.

Thanks

like image 91
Riccardo Cohen Avatar answered Mar 22 '26 09:03

Riccardo Cohen