catolicasc / alfresco-form-model-management

Automatically exported from code.google.com/p/alfresco-form-model-management
0 stars 0 forks source link

Save error when form has checkboxes field type #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new model and aspect for that model
2. In the new aspect add a field type dropdown with multiple options. Save
3. On Share, edit metadata and select a checkbox option. Click Save

What is the expected output? What do you see instead?
In the edit-medata view on Alfresco Share any time there is a checkbox field 
type in the form, the form cannot be saved when clicking on Save button.  The 
ajax message save always say "undefined item(s) saved successfully. 1 item(s) 
failed."  If I remove the checkbox field type from the form and just use other 
field types the form can be saved successfully.

On a side request, is it possible to stop the form from navigating away from 
the current edit-metadata view if there is an error upon saving the form? 
Sometimes the user does not pay attention to the save message (it goes by very 
quickly) and the form data does not get saved and the user wouldn't know if 
there was a problem. 

What version of the product are you using? On what operating system?
form management 1.3.4.1, share 2.4, Alfresco 4.0.e

Please provide any additional information below.

Original issue reported on code.google.com by anhthan...@gmail.com on 7 Nov 2012 at 11:56

Attachments:

GoogleCodeExporter commented 8 years ago
Additional information:

If I use firebug and inspect the object postSettings.storeObj before it is sent 
to ajax function (save: in form.jquery.js) here is what is in it when the form 
has a single checkbox checked.

"[{"qname":"pts_documenttypes","value":"dtChkbox","type":"d_text"},{"qname":"tes
t_checkboxes","value":["a"],"type":"d_text"}]"

If I remove the square bracket around ["a"] then the form is able to save 
correctly.

"[{"qname":"pts_documenttypes","value":"dtChkbox","type":"d_text"},{"qname":"tes
t_checkboxes","value":"a","type":"d_text"}]"

But this will not work if there are more than one checkboxes checked. Can you 
let me know which file has the procedure that handles the parsing of the data 
from postSettings before saving it to the database?  Thank you. 

Original comment by anhthan...@gmail.com on 17 Nov 2012 at 1:28

GoogleCodeExporter commented 8 years ago
Hi there, in your form design. Make sure you have multiple turned on. This 
allows alfresco to store an array of values (the checkbox values).

This is available in the alfresco options when you select the field.

Original comment by mike.pri...@abstractive.ca on 17 Nov 2012 at 11:55

GoogleCodeExporter commented 8 years ago
Please let me know if this solves your issue.

Original comment by mike.pri...@abstractive.ca on 17 Nov 2012 at 11:56

GoogleCodeExporter commented 8 years ago
Thank you for your reply. If I turn on the "Multiple" option for the checkboxes 
field the form would save successfully but when I return to view the form the 
checkboxes that were checked do not show as selected.  So all the checkboxes 
show up as blank.  

Original comment by anhthan...@gmail.com on 19 Nov 2012 at 9:23

GoogleCodeExporter commented 8 years ago
What version of alfresco and form management are you using. I have tested its 
ok with everything up to 4.0.2

I haven't got around to going through everything in 4.2 Community yet. 
Sometimes Alfresco doesn't think switching from single to multiple is 
"incremental" when going through hot deploy so it doesn't persist.

You could try creating another field and adding multiple right away.

Original comment by mike.pri...@abstractive.ca on 20 Nov 2012 at 4:13

GoogleCodeExporter commented 8 years ago
I've tested it again with clean install and new checkbox test with multiple 
option switched on to on.  I'm using form management 1.3.4.1, share 2.4, 
Alfresco Community 4.0.e.  

Also, can you advise on how to clear the message "There was a problem 
validating the model, one or more properties maybe in use." every time I make 
changes to a form and saving the form in the form administration view?  I made 
sure that there are no objects using the current form model but that message 
always persists.  Most of the time I have to recreate a new form every time I 
want to make changes to an existing form. 

Can you tell me the places to check so that the current model is not in used?  
I tried deleting the documents that had the form data previously and removing 
it from trash. Should I look into the data in the database as well?  I'm not 
sure if there are other places I could check to have the form model available 
to be updated without that error message popping up.  Thank you.

Original comment by anhthan...@gmail.com on 21 Nov 2012 at 1:50

GoogleCodeExporter commented 8 years ago
If you have a look at the console in firebug when the ajax post is made - it 
gives you a bit more information.

Most of the time its alfresco that just won't let the change happen; this is 
due to the incremental changes to dynamic models. Sadly there's nothing we can 
really do about it. On the flip side sometimes its related to the removal of 
fields and nodes using that aspect. Typically you would remove the document 
from both the doc lib and trash. However, since 4.0.x it seems it just doesn't 
like deletion at all (im looking into this issue).

I'm going to see if i can replicate your environment. Does the console give you 
anything about the checkboxe's when saving and/or does the GET request for the 
node (/alfresco/wcs/form-management/get-properties) have options in the JSON 
object?

Mike

Original comment by mike.pri...@abstractive.ca on 21 Nov 2012 at 4:19

GoogleCodeExporter commented 8 years ago
Hi Mike, I figured out the problem.  It turns out somehow I had the older 
version of the file form.jquery.js on the system.  The if statement that checks 
for the checked checkboxes did not check when the property is an object.  I 
think this was from the older version.  I have many customizations on the 
module and each time it gets updated I have to migrate my customizations over 
to the new version but somehow I missed a part of this code.  Sorry for the 
trouble. Thank you for the support.

Original comment by anhthan...@gmail.com on 28 Nov 2012 at 12:38

GoogleCodeExporter commented 8 years ago
Hey, no problem. I'm glad you found the issue! I will change the bug status to 
fixed.
Cheers, Mike

Original comment by mike.pri...@abstractive.ca on 28 Nov 2012 at 12:56