Hi,
If a value is entered manually in a Lookup Object (without pressing tabulator), It is not stored in the database.
(Because the Lookup's AJAX request is not finished by the time the form is saved.)
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Lookup Value not saved
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Lookup Value not saved
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Lookup Value not saved
There is another scenario when saving does not work as expected:
1. A value has been picked in a lookup field (e.g. FF1).
2. Clear the field
3. Hit Save
Result: FF1 is still stored to the DB.
1. A value has been picked in a lookup field (e.g. FF1).
2. Clear the field
3. Hit Save
Result: FF1 is still stored to the DB.
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Lookup Value not saved
The easiest way is probably to check whether the lookup description is empty but a value is entered in the lookup code. (Or if the description is not empty and the value is blank)admin wrote: What do suggest?
Then display a message that the lookup operation is still in progress.
Of course, this can be further improved.
Like detecting when the lookup operation is complete and if a save operation is "pending", save the form. But for now, that should serve the purpose.
Code: Select all
function nuLookupPending() {
var p = false;
$('[data-nu-type="lookup"][id$="code"]').each(function(){
var d = $('#' + this.id.slice(0, -4) + 'description');
p = (d.val() == '' && $(this).val() !== '') || (d.val() !== '' && $(this).val() == '')
return false;
});
return p;
}
function nuSaveAction(){
if (nuLookupPending()) {
nuMessage([nuTranslate('A lookup operation is still in progress. Please save again when complete.')]);
return;
}
if(nuNoDuplicates()){
nuUpdateData('save');
}
}
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Lookup Value not saved
Next up, let's this fix in action:
1. Enter a code and save 2. Clear a code and save
1. Enter a code and save 2. Clear a code and save
You do not have the required permissions to view the files attached to this post.
Re: Lookup Value not saved
kev1n,
I've added a Lookup checking thing before saving a record.
Its now on Github.
(Not exactly what you suggested but thanks anyway)
Please test it.
Steven
I've added a Lookup checking thing before saving a record.
Its now on Github.
(Not exactly what you suggested but thanks anyway)
Please test it.
Steven
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact: