mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-02-04 05:35:44 +00:00
* use bind:get and bind:set to fix strange behavior on input while using server rendering * only update the Immediate textarea and textbox --------- Co-authored-by: Steven Torrelle <steven.torrelle@uzgent.be>
30 lines
1.6 KiB
Plaintext
30 lines
1.6 KiB
Plaintext
@inherits FormComponentWithAutoComplete<string>
|
|
@if (Visible)
|
|
{
|
|
if (Immediate)
|
|
{
|
|
@RenderImmediateInput()
|
|
}
|
|
else
|
|
{
|
|
<input @ref="@Element" id="@GetId()" disabled="@Disabled" readonly="@ReadOnly" name="@Name" style="@Style" @attributes="Attributes" class="@GetCssClass()" tabindex="@(Disabled ? "-1" : $"{TabIndex}")"
|
|
placeholder="@CurrentPlaceholder" maxlength="@MaxLength" autocomplete="@AutoCompleteAttribute" aria-autocomplete="@AriaAutoCompleteAttribute" value="@Value" @onchange="@OnChange" />
|
|
}
|
|
}
|
|
|
|
@code {
|
|
internal RenderFragment RenderImmediateInput()
|
|
{
|
|
#if NET7_0_OR_GREATER
|
|
return __builder => {
|
|
<input @ref="@Element" id="@GetId()" disabled="@Disabled" readonly="@ReadOnly" name="@Name" style="@Style" @attributes="Attributes" class="@GetCssClass()" tabindex="@(Disabled ? "-1" : $"{TabIndex}")"
|
|
placeholder="@CurrentPlaceholder" maxlength="@MaxLength" autocomplete="@AutoCompleteAttribute" aria-autocomplete="@AriaAutoCompleteAttribute" @bind:get="@Value" @bind:set="@SetValue" @bind:event="oninput"/>
|
|
};
|
|
#else
|
|
return __builder => {
|
|
<input @ref="@Element" id="@GetId()" disabled="@Disabled" readonly="@ReadOnly" name="@Name" style="@Style" @attributes="Attributes" class="@GetCssClass()" tabindex="@(Disabled ? "-1" : $"{TabIndex}")"
|
|
placeholder="@CurrentPlaceholder" maxlength="@MaxLength" autocomplete="@AutoCompleteAttribute" aria-autocomplete="@AriaAutoCompleteAttribute" value="@Value" @oninput="@OnChange" />
|
|
};
|
|
#endif
|
|
}
|
|
} |