Submit button with required fields notification.
Hi, I have a very limited knowledge when it comes to writing scripts so please consider this when answering. I have form for managers where they have to fill up information about sales and production every day. There is about 20 fields in a form and all are required. I have found how to write it for one field but what if I have many? Looking for some simple solution when they click on submit button and if some required fields are not filled it will show message which fields are not filled (or even message “fill up required fields” is enough) and it will prevent them from closing the form until everything is filled.
27 replies
-
i have made one more button for another report, but has the same problem as with button for DAILY SALES, when i add at then the part to delete information from field, line 127 it shows problem. Any chance you could look please what I am doing wrong? I have used null or 0 according what you wrote before.
let t := this; let xlf := urlDecode("%0A"); let dateCheck := if Date = null then 1 else 0 end; let productsCheck := if PRODUCT = null then 1 else 0 end; let shopsCheck := if SHOP = null then 1 else 0 end; let employeesCheck := if NAME = null then 1 else 0 end; let preparedwhereCheck := if PREPARED = null then 1 else 0 end; let startCheck := if START = null then 1 else 0 end; let endCheck := if END = null then 1 else 0 end; let breakstartCheck := if 'BREAK START' = null then 1 else 0 end; let breakendCheck := if 'BREAK END' = null then 1 else 0 end; let break2startCheck := if 'BREAK 2 START' = null then 1 else 0 end; let break2endCheck := if 'BREAK 2 END' = null then 1 else 0 end; let break3startCheck := if 'BREAK 3 START' = null then 1 else 0 end; let break3endCheck := if 'BREAK 3 END' = null then 1 else 0 end; let kgpreparedCheck := if 'KG PREPARED' = null then 1 else 0 end; let itemspreparedCheck := if 'ITEMS PREPARED' = null then 1 else 0 end; let itemsrejectedCheck := if 'ITEMS REJECTED' = null then 1 else 0 end; let fieldCheck := [dateCheck, productsCheck, shopsCheck, employeesCheck, preparedwhereCheck, startCheck, endCheck, breakstartCheck, breakendCheck, break2startCheck, break2endCheck, break3startCheck, break3endCheck, kgpreparedCheck, itemspreparedCheck, itemsrejectedCheck]; if sum(fieldCheck) = 0 then let newRec := (create 'HANGING PRODUCTION'); newRec.( DATE := t.Date; PRODUCT := t.PRODUCT; SHOP := t.SHOP; NAME := t.NAME; 'PREPARED WHERE' := t.PREPARED; START := t.START; END := t.END; 'BREAK START' := t.'BREAK START'; 'BREAK END' := t.'BREAK END'; 'BREAK 2 START' := t.'BREAK 2 START'; 'BREAK 2 END' := t.'BREAK 2 END'; 'BREAK 3 START' := t.'BREAK 3 START'; 'BREAK 3 END' := t.'BREAK 3 END'; 'KG PREPARED' := t.'KG PREPARED'; 'ITEMS PREPARED' := t.'ITEMS PREPARED'; 'ITEMS REJECTED' := t.'ITEMS REJECTED' ); alert("New Record Added") else alert("Please fill in the following fields:" + if item(fieldCheck, 0) = 1 then xlf + "DATE" end + " " + if item(fieldCheck, 1) = 1 then xlf + "PRODUCTS" end + " " + if item(fieldCheck, 2) = 1 then xlf + "SHOPS" end + "" + if item(fieldCheck, 3) = 1 then xlf + "NAME" end + "" + if item(fieldCheck, 4) = 1 then xlf + "PREPARED" end + "" + if item(fieldCheck, 5) = 1 then xlf + "START" end + "" + if item(fieldCheck, 6) = 1 then xlf + "END" end + "" + if item(fieldCheck, 7) = 1 then xlf + "BREAK START" end + "" + if item(fieldCheck, 8) = 1 then xlf + "BREAK END" end + "" + if item(fieldCheck, 9) = 1 then xlf + "BREAK 2 START" end + "" + if item(fieldCheck, 10) = 1 then xlf + "BREAK 2 END" end + "" + if item(fieldCheck, 11) = 1 then xlf + "BREAK 3 START" end + "" + if item(fieldCheck, 12) = 1 then xlf + "BREAK 3 END" end + "" + if item(fieldCheck, 13) = 1 then xlf + "KG PREPARED" end + "" + if item(fieldCheck, 14) = 1 then xlf + "ITEMS PREPARED" end + "" + if item(fieldCheck, 15) = 1 then xlf + "ITEMS REJECTED" end + " ") end Date := null; PRODUCT := 0; SHOP := 0; NAME := 0; PREPARED := null; START := null; END := null; 'BREAK START' := null; 'BREAK END' := null; 'BREAK 2 START' := null; 'BREAK 2 END' := null; 'BREAK 3 START' := null; 'BREAK 3 END' := null; 'KG PREPARED' := null; 'ITEMS PREPARED' := null; 'ITEMS REJECTED' := null; end
-
There is also a shorter version, see attachment of Fred's adapted example database (open Dashboard and Field Check tab). Also easier to expand if fields need to be added or if you have a lot of required fields...
Content aside
- Status Answered
- 8 days agoLast active
- 27Replies
- 380Views
-
5
Following