1
+ let programmingLanguages = [ ] ;
2
+ let webTechnologies = [ ] ;
3
+ let webFrameworks = [ ] ;
4
+ let dbms = [ ] ;
5
+ let operatingSystem = [ ] ;
6
+ let technologies = [ ] ;
7
+ let cloudHostingPlatforms = [ ] ;
8
+ let interest = {
9
+ preference1 :'' ,
10
+ preference2 :'' ,
11
+ preference3 :''
12
+ } ;
13
+
14
+ function setProgrammingLanguages ( ) {
15
+ document . querySelectorAll ( '.programmingLanguages select' ) . forEach ( input => {
16
+ if ( input . value ) {
17
+ programmingLanguages . push ( {
18
+ name :input . getAttribute ( 'data-name' ) ,
19
+ level :input . value
20
+ } )
21
+ }
22
+ } )
23
+ document . querySelector ( 'input[name=programmingLanguages]' ) . value = JSON . stringify ( programmingLanguages ) ;
24
+ }
25
+ function setWebTechnologies ( ) {
26
+ document . querySelectorAll ( '.webTechnologies select' ) . forEach ( input => {
27
+ if ( input . value ) {
28
+ webTechnologies . push ( {
29
+ name :input . getAttribute ( 'data-name' ) ,
30
+ level :input . value
31
+ } )
32
+ }
33
+ } )
34
+ document . querySelector ( 'input[name=webTechnologies]' ) . value = JSON . stringify ( webTechnologies ) ;
35
+ }
36
+ function setWebFrameworks ( ) {
37
+ document . querySelectorAll ( '.webFrameworks select' ) . forEach ( input => {
38
+ if ( input . value ) {
39
+ webFrameworks . push ( {
40
+ name :input . getAttribute ( 'data-name' ) ,
41
+ level :input . value
42
+ } )
43
+ }
44
+ } )
45
+ document . querySelector ( 'input[name=webFrameworks]' ) . value = JSON . stringify ( webFrameworks ) ;
46
+ }
47
+ function setDbms ( ) {
48
+ document . querySelectorAll ( '.dbms select' ) . forEach ( input => {
49
+ if ( input . value ) {
50
+ dbms . push ( {
51
+ name :input . getAttribute ( 'data-name' ) ,
52
+ level :input . value
53
+ } )
54
+ }
55
+ } )
56
+ document . querySelector ( 'input[name=dbms]' ) . value = JSON . stringify ( dbms ) ;
57
+ }
58
+ function setOperatingSystem ( ) {
59
+ document . querySelectorAll ( '.operatingSystem select' ) . forEach ( input => {
60
+ if ( input . value ) {
61
+ operatingSystem . push ( {
62
+ name :input . getAttribute ( 'data-name' ) ,
63
+ level :input . value
64
+ } )
65
+ }
66
+ } )
67
+ document . querySelector ( 'input[name=operatingSystem]' ) . value = JSON . stringify ( operatingSystem ) ;
68
+ }
69
+ function setTechnologies ( ) {
70
+ document . querySelectorAll ( '.technologies select' ) . forEach ( input => {
71
+ if ( input . value ) {
72
+ technologies . push ( {
73
+ name :input . getAttribute ( 'data-name' ) ,
74
+ level :input . value
75
+ } ) ;
76
+ }
77
+ } ) ;
78
+ document . querySelector ( 'input[name=technologies]' ) . value = JSON . stringify ( technologies ) ;
79
+ }
80
+ function setCloudHostingPlatforms ( ) {
81
+ document . querySelectorAll ( '.cloudHostingPlatforms input[type=checkbox]' ) . forEach ( input => {
82
+ if ( input . checked ) {
83
+ cloudHostingPlatforms . push ( input . getAttribute ( 'data-name' ) ) ;
84
+ }
85
+ } )
86
+ document . querySelector ( 'input[name=cloudHostingPlatforms]' ) . value = JSON . stringify ( cloudHostingPlatforms ) ;
87
+ }
88
+ function setInterest ( ) {
89
+ interest . preference1 = document . querySelector ( '.interest select[data-name=preference1]' ) . value ;
90
+ interest . preference2 = document . querySelector ( '.interest select[data-name=preference2]' ) . value ;
91
+ interest . preference3 = document . querySelector ( '.interest select[data-name=preference3]' ) . value ;
92
+ document . querySelector ( 'input[name=interest]' ) . value = JSON . stringify ( interest ) ;
93
+ }
94
+ document . querySelector ( 'form' ) . addEventListener ( 'submit' , function ( event ) {
95
+ event . preventDefault ( ) ;
96
+ setProgrammingLanguages ( ) ;
97
+ setWebTechnologies ( ) ;
98
+ setWebFrameworks ( ) ;
99
+ setDbms ( ) ;
100
+ setOperatingSystem ( ) ;
101
+ setTechnologies ( ) ;
102
+ setCloudHostingPlatforms ( ) ;
103
+ setInterest ( ) ;
104
+ document . querySelector ( 'input[name=whatsAppPhoneNumber]' ) . value = '91' + document . querySelector ( 'input[name=whatsAppPhoneNumber]' ) . value ;
105
+ console . log ( document . querySelector ( 'input[name=whatsAppPhoneNumber]' ) . value ) ;
106
+ document . querySelector ( 'input[name=callingPhoneNumber]' ) . value = '91' + document . querySelector ( 'input[name=callingPhoneNumber]' ) . value ;
107
+ console . log ( document . querySelector ( 'input[name=callingPhoneNumber]' ) . value ) ;
108
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=programmingLanguages]' ) . value ) ) ;
109
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=webTechnologies]' ) . value ) ) ;
110
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=webFrameworks]' ) . value ) ) ;
111
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=dbms]' ) . value ) ) ;
112
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=operatingSystem]' ) . value ) ) ;
113
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=technologies]' ) . value ) ) ;
114
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=cloudHostingPlatforms]' ) . value . toString ( ) ) ) ;
115
+ console . log ( JSON . parse ( document . querySelector ( 'input[name=interest]' ) . value ) ) ;
116
+ this . submit ( ) ;
117
+ } )
0 commit comments