Issue with save button being disabled when editing information in a live form

0

I'm having a bit of a problem figuring out why the 'save' button in my LiveForm's EditPanel is being disabled when I attempt to make an update to some data.

 

Basically here's what happens:

I select an item from a DataGrid and its information populates the LiveForm (which has three lookup editors).

I click the 'Update' button to allow me to edit the information in the LiveForm.

I change any information in any of the non-lookup editors (such as checking a checkbox or editing text) or click on a lookup editor then click elsewhere. Now the 'Save' button becomes disabled.

To re-enable the save button, I have to click on each lookup editor once and then click anywhere else.

 

To attempt to illustrate my problem, I uploaded an image sequence of what happens here: http://yfrog.com/jqliveformsavebuttonissuep

 

From my troubleshooting attempts, I appear to have determined that this only happens if there are lookup editors in my LiveForm. If there are no lookup editors, the problem does not occur. When I have any number of lookup editors, the problem occurs.

Furthermore, I have found that after loading the application, if I first create a new database entry with the LiveForm, then the problem does not occur. Also after loading the application, once I click on the three lookup editors, and successfully update, the problem does not occur.

 

If anyone can tell me why this is happening and how to fix it, I would greatly appreciate it.

edc's picture

Hi Rick,

It's not clear exactly what you've got going on there, but here's a few things we can say....

The save button is disabled because required fields are not populated.

You've determined it only occurs with lookup editors, which appear to have values. Thus I would have to guess that the display value of the lookup is set, but not the data value.
Call getDataValue() on the lookup editor when it is in that state to test this.

Thanks for the response, Ed.

When the save button is in the disabled state, I ran the following:

main.sectionLookup1.getDataValue();

main.deliveryMethodLookup1.getDataValue();

main.userLookup1.getDataValue();

and all three return an object with the appropriate id numbers and names. (screenshot here: http://yfrog.com/63capturepap)

So it would appear that the three editors data values are set.

Hi All,

>Furthermore, I have found that after loading the application, if I first create a new database entry >with the LiveForm, then the problem does not occur. Also after loading the application, once I >click on the three lookup editors, and successfully update, the problem does not occur.

Just now, for the first time, I have noticed this behavior in one my app. The app has some pages (displayed in a PageContainer) that contain a liveForm with lookup editors. Only one of these pages has this problem. I load the app and if I  first go to this page, the lookup is empty. It is enough to open another page and then come back to the page and lookup is populated. The other pages's lookup never have shown the problem.
In test mode the problem vanish.
I tryed to look for a workaround without successfull.

Stefano

edc's picture

That could be at play here.
There is a known issue with lookup editors in the dev builds.
They only populate in ?debug mode. They do not in gzip mode (not ?debug).
http://dev.wavemaker.com/wiki/bin/view/Dev/DevBuilds?srid=UUIw6hiE#HKnownIssues

I'm not running a dev build. I'm using the the Community version 6.0.6GA.

davidfilmer's picture

It's not just dev builds that have some problems with related editors.  I discovered that they can behave differently depending on where the form is placed on the page (and this is in 6.0.6GA):

http://dev.wavemaker.com/forums/?q=node/3948

You might want to try repositioning the form (especially by placing it beneath the grid) to see if it makes any difference.  I kinda doubt it  will - it sounds like you have a different type of problem - but it's a quick and easy thing to test.

 

Thank you for the response, David.

The form is below the grid. I tried moving it above the grid and the problem persists.

Is there a build I should try where this won't occur?

Just to follow up on this a bit as I've been trying to understand this problem a bit better.

The save button's disabled property is bound to editPanel1.formInvalid, and I cannot figure out why this is being set to true when all the form's required fields are filled in, then set to false after clicking on then off my three related editors (without changing their values). Is there someway I can override the code that sets this formInvalid value?

Anyway, to work around this issue I removed the binding between the save button's disabled property and editPanel1.formInvalid. So now the save button is always available, and when the user clicks on it I just have some code to check the required fields and alert the user if any required fields are blank.

If anyone can help me figure out my issue with the disabled save button, I'd still appreciate it since I'd prefer it to behave as intended by the widget.

 

davidfilmer's picture

A demo project would be great. But I would at least like to see the structure of the widgets that define this liveForm (if you could cut-and-paste the liveForm section from your widgets.js file).

Did you create this entire form from scratch, or did you cut-and-paste any elements from any other form?

As a troubleshooting technique, I wonder what would happen if you attached a handler to one of the other form elements (such as the checkbox) that simulates in JavaScript what you do manually to re-enable the Save button - such as:

this.userLookup1.focus();

for each related editor, and then do a this.someOtherWidget.focus() on some other field.

That's essentially what you are doing manually. If that does nothing, I wonder what would happen if you replaced the focus() on the related editors with something like:

this.userLookup1.setValue("name", this.userLookup1.getValue("name") );

I wonder if checking the box with such a handler would cause the Save button to become selectable.

edc's picture

Any chance you could post a test case ? I have not yet repro'd this behaviour. We're working on related editors for the beta and I'd like to know what's going on here too. Thanks.

Thanks for the response. I apologize for the delay in my response as I don't work on this project every day.

I'd be happy to post a test case, but I'm not really sure what that would entail. If you wouldn't mind telling me what I should post, I'll provide whatever I can.

edc's picture

To post a test case, it's usually best to use a Project Export. A simple project that demonstrates just the issue is best. Thanks !

Alright. I want to take another look at my issue and try to figure out a little more about it. After doing so, I will post a project export.

One problem solved, moving straight on to the next ;->

My project replicates venutolo's problem exactly. I have attached sample project. (auto-increment of ID only works if you mark ID as not required after importing - but you know this)

Cheers,

Doro

AttachmentSize
Project1.zip 53.9 KB
Project1.sql_.zip 3.85 KB
edc's picture

Thanks for the testcase Doro.

In 6.0.6 it behaves exactly as described. During the first update of a grid selected item, enter a value in another field and save is disabled.

The good news is that it works correctly in the 616 beta, which is not available. Please try the beta and confirm you see same.

Thanks again for the testcase.

I'm glad I'm not the only one having this issue. Thanks to Doro for posting a test case with the same issue before I got around to it.

edc's picture

Test cases do help. Not only do they help us help you, sometimes we can't figure out how to make it fail from a description alone.

I see that on 3/31 I wrote the beta is 'not available', it is. Suspected I meant to type 'now' -g-

We have found issues with the beta. Most notably re-dragging a widget on the canvas does not work. You can drag a widget to the canvas, but once there, you can move it (create a new instead).
We'll be updating the beta build soon for that and other fixes.

vinicio's picture

I encountered the same problem in 6.5.M1 in a project with many pagecontrol, liveforms and dialog forms.
therefore I confirm the frequently existence of this bug!

Vinicio Montagnoli
==================

mkantor's picture

A lot has changed since then. It would be helpful if you
1. Posted this in a new thread
2. Posted details on what you are seeing
3. A project export might be helpful as well (or a video)

Finally, we are working on shipping a new Milestone, it could be that this issue is cleaned up already, and was unrelated to the issue from two years ago except in its symptoms.

Michael Kantor
SMTS; WaveMaker/SpringSource/VMware