Advertisement
MindKooper

Untitled

Nov 1st, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. let errors = [];
  2. if (!isValidApplicationId(appId)) {
  3. errors.push({ valid: false, name: "appId", app_id: appId, message: 'Application ID is not valid; it must only contain lower case characters, 0-9, - and _, and be between 4 and 50 characters long.' });
  4. }
  5. if (!isValidApplicationName(appName))
  6. errors.push({ valid: false, name: "appName", app_name: appName, message: 'Application Name is not valid; It must not contain special characters. List:!"#$%&()*+,-./:;<=>?@[\]^_`{|}~' });
  7. if (Array.isArray(errors) && errors.length) {
  8. return res.json(errors);
  9. }
  10.  
  11.  
  12.  
  13.  
  14. data.forEach(item => {
  15. if (item.name === 'appName') {
  16. $('#errorAppname').text(item.message);
  17. }
  18. if (item.name === 'appId') {
  19. $('#errorAppid').text(item.message);
  20. }
  21. });
  22. if ( data.length === 0 ) {
  23. $('#new_app_form').submit();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement