Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1179
IgbInput - get current value
posted

Hi,

I'm using the Prefix & Suffix example or the input control as a starting point (Link), and I'm trying to respond to a click event on the suffix part of the control. This is my component definition:

        <IgbInput @ref="ctlSearchText" Inputmode="@InputInputmode.Txt" DisplayType="@InputType.Text" Label="" >
            <span slot="prefix">Find</span>
            <IgbIcon slot="suffix" @ref="IconRef" IconName="phone" Collection="material" onclick="@(async ()=> await DoSearch())"/>
        </IgbInput>

The problem I'm having is that when my click handler is called I'm unable to get the current value from the IgbInput - it always returns an empty string. I've tried a number of approaches:

  • using the Value property to reference a string variable - binding is one way only though, as you'd expect
  • providing a handler for ValueChanged - only fires when the control loses focus, so doesn't fire in time for the click handler
  • handling various other blazor or native events, but with either nothing firing, or with similar issues to ValueChanged

The closest I've got is handling the keypress event, but that isn't any use as it only provides the last character pressed, and I can't reliably use this to get the full control text

I'm sure I must be missing something, after all, what use is an editable component if you can't retrieve the value that is being edited, but I'm drawing a blank on how to proceed - any suggestions?

Parents
No Data
Reply Children