Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Making Lookup/picker a required field #10163


User avatar
0
Astech created

Hi,

We are using the ASP Net Zero lookup:

I can see in the code it is essentially a disabled text box that shows the selection of the picker:

Is there any way to make the control required? i.e. a selection must be made. At the moment adding required to the input does not work because it is disabled. And we want to keep it disabled because we only want the text set from the picker.

Any ideas? Cheers


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Is this an auto-generated code block by Power Tools ? If not, you can add required attribute to the input element, so it will be validated when user submits the form.

    If it is Power Tools generated, then not-selecting Nullable on the Power Tool should make the field required.

  • User Avatar
    0
    Astech created

    Hi @ismcagdas

    Thanks for your reply.

    you can add required attribute to the input element, so it will be validated when user submits the form.

    Unfortunately this does not work. The input is disabled and when disabled it also disables the required attribute.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks. Could you create an issue on https://github.com/aspnetzero/aspnet-zero-core ? Our team will check this problem and find a solution.

    Thanks,

  • User Avatar
    0
    Astech created

    Hi ismcagdas,

    I have found a workaround which is to mark the field as readonly instead of disabled. This then allows the required attribute work.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Thank you for sharing the solution :)