Hello. I am using a form to update a collections. In this form i have some fields that user input data and some fields that are calculated based on other fields.. This calculating are done by some code in javascript.
The page works ok and show all the datas fine (the user inputs and the calculated fields). So i submitted this data and everithing gone ok.. but when i look to de collections, all the calculated fields are with some errors.. the message showed : "Cell data type is URL. Change to Number."
one of the fields in the form ($w("#reTotal") is updated by:
export function soma_presenca(){
let total = parseInt($w("#reMCP").value,10) + parseInt($w("#reVisitantes").value,10) + parseInt($w("#reVCelulas").value,10) + parseInt($w("#reCRI").value,10);
$w("#reTotal").value = total;
}
This function is called by other event field (onChange). In the page.. this field show teh correct valor of the sum... but in the collections, the msg above is shown!!!
I have the same problem too.
Hi Saymon, unfortunately it appears that this is a limitation of Wix Code at the moment. I've escalated it to the proper people and hopefully we'll have a solution in the future.
In the meantime, you can continue to use the setFieldValue( ) function as a workaround. I apologize that we did not recognize this limitation sooner! Good luck with your site.
Hello, thanks for answer... Well.. I tried what you said... Even didn't work. So.. I test this way:
put the value of sum direct into the dataset field using $w("MyDataSet").setfieldvalue("fieldname", value). This worked.
So every time i used some code and put the result into the $w("field").value didn't work... I test so many set ups and nothing...
Hi W. Saymon Silva,
Your 'Total' input field is read-only, therefore when you change it's value from code, the value is not saved into collection. It sends empty value instead - it is as designed. Why it shows cell type as URL in collection, it is another issue - we will fix it.
As a workaround for your case, if you want to store it in collection, I suggest you to try adding another component on page, do not make it read-only, hide it, and set total value for both - total input and this new hidden input. Then bind this new hidden input to the field in collection.
This should work, let us know
Thanks
Hello.. anything new?
Ok.
Here is the link to my edit page: http://editor.wix.com/html/editor/web/renderer/edit/b666a81d-2d1a-4ca3-b6b7-d5bf13a5b6c2?metaSiteId=e08c40f3-f63b-4754-960b-e074803f08e0&editorSessionId=2EA4FA60-2BB7-4C37-BCFF-1D9A5BCEA9A2
and here the link to site page: http://comejeap.wixsite.com/comeje/cadastro-de-relatorio
This happens with the fields [semana] and [total].
Thank you
Hi!
Please share site and page where you see this error. I can check
Anyone???? I still need help on this
thanks for answer.. but my field in collections is number format.. i have no URL field. Anyway, I just saw now to confirm.. the field is number format...
Hi Saymon,
It looks like the field type in your collection is configured as URL, and your value is a number.
You can change the field type on a specific column, by heading to the title of the column where you see the error, click the 3 dot notation, go to Manage Properties, and update the Field Type to Number.
Attached a screenshot as an example.
Happy New WixCode year,
Dana.
In fact, what I want is:
$w(#reTotal").value = x+y;
and this goes correctly to the collection when i submit...