-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathValidate.wmls
More file actions
48 lines (46 loc) · 1.68 KB
/
Validate.wmls
File metadata and controls
48 lines (46 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Author: Amey Thakur
Course: Mobile Communication and Computing (MCC) & Mobile Application Development Lab (MAD Lab)
Semester: VII | Batch: B3 | Roll No: 50
Experiment: 5 - WML Form Validation for WAP-enabled Phones
Date: August 20, 2021
GitHub: https://github.com/Amey-Thakur
Repository: https://github.com/Amey-Thakur/MOBILE-COMMUNICATION-AND-COMPUTING-AND-MOBILE-APPLICATION-DEVELOPMENT-LAB
*/
extern function validate()
{
var form_firstname = String.trim(WMLBrowser.getVar("firstname"));
var form_lastname = String.trim(WMLBrowser.getVar("lastname"));
var form_password = String.trim(WMLBrowser.getVar("password"));
var form_email = String.trim(WMLBrowser.getVar("email"));
var form_name = String.trim(WMLBrowser.getVar("name"));
var form_birthday = String.trim(WMLBrowser.getVar("birthday"));
if (""==form_firstname){
WMLBrowser.setVar("errorMsg", "The First Name field must not be empty.");
WMLBrowser.refresh();
return;
} if (""==form_lastname){
WMLBrowser.setVar("errorMsg", "The Last Name field must not be empty.");
WMLBrowser.refresh();
return;
}
if (""==form_password){
WMLBrowser.setVar("errorMsg", "The Password field must not be empty.");
WMLBrowser.refresh();
return;
}
if (""==form_email){
WMLBrowser.setVar("errorMsg", "The Email field must not be empty.");
WMLBrowser.refresh();
return;
}
if (String.length(form_password) < 8){
WMLBrowser.setVar("errorMsg", "The password must contain at least 8 characters since a short password is less secure.");
WMLBrowser.refresh();
return;
}
else{
WMLBrowser.setVar("errorMsg", "THANK YOU FOR FILLING THE FORM");
WMLBrowser.refresh();
} submit_form(form_firstname,form_lastname, form_password, form_email, form_name, form_birthday);
}