Need Help: Enable/Disable Input Field and Auto Update Age from DOB in Alpha

Hello @Simphiwe

I want to enable and disable an input field on the click of a button. Also, I want to update data dynamically.

For example:
If I select the Date of Birth, the Age should auto-populate.

I’ve added custom code and I’m getting the correct values in the variables.
But the problem is:

  • The value is not updating on the UI.

  • On button click, the variable is changing, but the input field is not becoming editable.

  • Also how can I use toggle button not getting the node

Can anyone help me figure out what I’m missing?

Hello @aniket ,
You can include the condition directly within the input field. For example, you can set a variable to !demoVar based on the required logic in your custom code while clicking a button, you can use local to store this thing, and then use that variable to control whether the input field is disabled or hidden.

I did the same I created one variable in local and used that with input field under dependency. Also updating this variable on button click, but my input field remains disable only. I added two conditions in dependency one is for true value and one is for false value

Hello @aniket ,
Can you share your project in my chat(private)?

Hello @aniket ,
It seems like you are not updating properly, please try to use alpha.local.update(“isEdite”,!alpha.local.get().isEdite) instead of alpha.local.get().isEdite = !alpha.local.get().isEdite and try once more. Please let me know if that works

@Sam It is working now thank you.
Just one thing want to know How can I use toggle button in alpha?

Hello @aniket ,
You can refer this
Adding Toggle Buttons, Input Boxes, and Dropdowns in Alpha Table Component - Community - Neutrinos

Hi @Sam I m trying this using Boolean value where variable is saved as CO, for that its not working.

or do we only use local varibale for this?

I have created a varibale as editApplicationForm in dataModel and using that but not working

alpha.co.update(true, alpha.co.get().editApplicationForm)

Hello @shubham.dhamne ,
I think you can initialize the value as false or true on on init. Then, you can use alpha.co.update("editApplicationForm", !alpha.co.get().editApplicationForm). Try this and let me know if it works

Ya its working… Thanks Sam