Read only an null

Hello,

I’m having some trouble with the dynamic read only.

I have a variable that’s set to 0, and my inputs have the read only attribute applied when that variable changes. I made it this way to prevent users from modifying inputs that shows data from the server connect.

The problem is that when I make those read only inputs editable, the ones that have null on the database, the input is set to null instead of nothing at all.

Here is a video with the bug:

an input example:

<input type="text" class="form-control" id="gas" name="gas" aria-describedby="gas_help" dmx-bind:value="QueryPropietarios.data.queryPropietarios.gas" dmx-bind:readonly="readonly.value == 0" autocomplete="nofill">

I have a very similar thing on a design I am working on.
Here’s the code for my input and it does not return null into the input.

input id=“inp_sd_address” name=“sd_address” type=“text” class=“form-control form-control-sm” dmx-bind:value=“view_staffdetails.data.details.address”
dmx-bind:readonly="(editStaffDetails.value == 0)"

only difference I can see is the ( ) on the bind:readonly.

I doubt this is causing the problem though.
Do you have a link to the page ??

It doesn’t work, I believe it’s a Wappler’s bug because there is no logical explanation of filling the input to “null” instead of leaving it blank after you turn a read only input to an editable one.

I made a ternary operation in order to fill the input to 0 whenever the input is blank.

I hope someone of Wappler’s team sees this post.

Thanks though!

1 Like

strange it works on mine, with no issues.

However the one thing that I do every time is fully uninstall Wappler and install the new version, as I have found sometime issues are caused by not doing that. Have you tried doing that?

No, I haven’t, i’ll give it a try

are you on Mac or windows?

mac

make sure you remove the Wappler folder from ~/Library/Application Support/
as well that should get rid of it, thats the way I do it when doing a clean install.

Wappler 3.0.0 rc2

I have this same problem… null values for integer database fields are being read as the literal text “null” into a form field and then failing validation when the user made no changes…

@Teodor, is there a fix for this please?

The input won’t show null values unless it is a string "null". Check your database results, what is in the json returned from the server, is it really a null or a string with null. Some database drivers returns values as strings instead of the native types, so probably the problem is on your server.