Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var callback_form = {
- values:{is_ok:false},
- objs:{},
- inputs:{},
- error_codes:{'fio': 'ФИО', 'telephone': 'телефон'},
- get_inputs:function()
- {
- var inputs = this.objs['c'].find (':input[type="text"]');
- var tmp = Array();
- for (var i in inputs)
- {
- if (inputs[i].name==="" || !inputs[i].name)
- {
- continue;
- }
- name = inputs[i].name;
- tmp[name] = inputs[i];
- }
- return tmp;
- },
- do_checks:function()
- {
- if (this.inputs['telephone'].value==="")
- {
- this.draw_error (this.inputs['telephone']);
- }
- if (this.inputs['fio'].value==="")
- {
- this.draw_error (this.inputs['fio']);
- }
- },
- draw_error:function(input)
- {
- $(input).attr ('style',"border: 3px solid #981a30");
- $('#errors_callback').append ('<p><span style="color:#981a30">Пожайлуста, введите '+this.error_codes[input.name]+'.</span></p>');
- },
- init:function()
- {
- this.objs['c'] = $("#callback");
- this.inputs = this.get_inputs();
- this.do_checks();
- //this.objs['errors'] = $('#errors_callback');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement