Page 1 of 1
Auto submit (if criteria are met) -> redirect new edit form
Posted: Thu Jan 18, 2018 1:18 pm
by pyro
Hi,
1. Check if field SN has 10 characters
2. If yes move check if string meets certain criteria (first to characters should be letters)
3. If string is ok
auto safe form
4. open new blank form (copy some values from the last form, e.g Product)
basically I have an usb barcode scanner where I want to scan many products in a row. Therefore it would be very unconvertible to always need to click save -> go back -> open new foam
Edit form.PNG
I hope someone can point me in the right direction.
Thank you very much
Re: Auto submit (if criteria are met) -> redirect new edit f
Posted: Thu Jan 18, 2018 2:24 pm
by toms
I'd attach an onchange handler to the SN field and there you check if the enterted string meets the criterias.
Then you call nuSaveAction(); to save the current record.
With nuCloneAction() you clone the record and in a function nuOnClone(), that will be run after the Clone action is done, you empty the SN field with $('#your_SN_field').val('');
Since the save action is executed asynchronously, you need to wait until the saving is finished before you clone the record. I haven't spotted an nuAfterSave() event though.
Re: Auto submit (if criteria are met) -> redirect new edit f
Posted: Thu Jan 18, 2018 8:47 pm
by admin
pyro,
If I understand what you're trying to do correctly...
You should have a main Edit Form for Product, User, Comment etc.
And a Subform for Serial Numbers.
2 Tables...
1. One to keep Product/Batch Details.
2. One to keep all the SNs (a primary key, a foreign key (that links to the product/batch table) and a serial number field.
That way...
- You can add up to 1000 serial numbers in the Subform without opening another Form.
- You are not keeping duplicate info for every serial number.
- If you had to change the comment for a batch of 10 things, you'll only need to do it once.
- You won't be filling the database with redundant data.
That's what I'm thinking.
eg.
sn.PNG
Steven
Re: Auto submit (if criteria are met) -> redirect new edit f
Posted: Fri Jan 19, 2018 4:44 pm
by pyro
Hi,
thank you very much for your great support.
I could archive it with the following code
Code: Select all
function nuOnClone() {
$('#sn_sn').val('');
$('#sn_sn').focus();
}
function checkchange() {
if ($('#sn_sn').val().length != 10) {
alert('This is not a Serial Number');
$('#sn_sn').val('');
return;
}
nuSaveAction();
setTimeout(function(){ nuCloneAction(); }, 1000);
}
@steven thank you for the further explanation, i will implement it for my next (more complex) project
Re: Auto submit (if criteria are met) -> redirect new edit f
Posted: Fri Jan 19, 2018 6:04 pm
by admin
.