**Hola, de antemano gracias por apoyarme en esto.
Mi requerimiento para el que me pueda ayudar es el siguiente:
Tengo este formulario en JS con un framework:**
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>ISCUS - TUTELAS ONLINE/title></title>
<link href='https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div ng-app="coolform" class="wrapper">
<div cool-form>
<div class="q-title">Vamos a preparar la historia...</div>
<div ng-repeat="q in questions" class="question">
<label>
<span class="q-text">
{{q.question}}
<span class="q-answer">
{{q.answer}}
</span>
</span>
<input type="text" id="q{{$index}}" ng-model="q.answer">
<span class="q-back" ng-click="open($index)"><</span>
</label>
<span class="q-next" ng-click="open($index+1)">></span>
</div>
<div class="q-after">
<hr>
<div class="q-confirm-text">¿Declara usted que toda la información suministrada es correcta y fidedigna?</div>
<div class="q-confirm-button">Lo declaro</div>
<div class="q-confirm-button">No lo declaro</div>
</div>
</div>
<center ng-show="activequestion > -1 && activequestion < questions.length">{{activequestion+1}} / {{questions.length}}</center>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
Este es el JS:
var coolform = angular.module('coolform', []);
coolform
.directive('coolForm', function($timeout) {
var ctrl = function($scope, $element, $attributes) {
$scope.questions = [];
$scope.activequestion = -1;
$scope.answering = true;
$scope.questions.push({'question': 'Ingresa tus dos nombre'});
$scope.questions.push({'question': 'Ingresa tus dos apellidos'});
$scope.questions.push({'question': 'Escribe una identificación válida'});
$scope.questions.push({'question': 'es en nombre propio?'});
$scope.questions.push({'question': 'Ingresa tu dirección'});
$scope.questions.push({'question': 'Por favor cuenta tu historia...'});
$scope.questions.push({'question': 'Cuál es tu petición?'});
$scope.questions.push({'question': 'Indica lo que pasó...'});
function removeOpen() {
for(i=0;i<qs.length;i++){
angular.element(qs[i]).removeClass('open');
}
}
var scrolle = document.getElementById('form-wrapper');
var qs = document.getElementsByClassName('question');
$scope.open = function(order) {
removeOpen();
if (order >= $scope.questions.length || order < 0) {
$scope.answering = false;
if ($element.hasClass('answering')) {
$element.removeClass('answering');
$scope.activequestion = $scope.questions.length+1;
}
} else {
$scope.answering = true;
if (!$element.hasClass('answering')) {
$element.addClass('answering');
}
//document.activeElement.blur();
$scope.activequestion = order;
var offset = qs[0].offsetTop;
if(order !== 0) {offset = qs[order-1].offsetTop;}
scrollToAndFocus(scrolle, offset, 500, order);
if (!angular.element(qs[order]).hasClass('open')) {
angular.element(qs[order]).addClass('open');
}
}
}
function scrollToAndFocus(element, to, duration, focus) {
if (duration <= 10) {
document.getElementById('q'+(focus)).focus();
return;
}
var difference = to - element.scrollTop;
var perTick = difference / duration * 10;
window.setTimeout(function() {
element.scrollTop = element.scrollTop + perTick;
if (element.scrollTop === to) return;
scrollToAndFocus(element, to, duration - 10, focus);
}, 10);
}
var handler = function(e){
if(e.keyCode === 37) {
//left arrow
e.preventDefault();
$scope.$apply(function() {
$scope.open($scope.activequestion-1);
});
}
if(e.keyCode === 39) {
//right arrow
e.preventDefault();
$scope.$apply(function() {
$scope.open($scope.activequestion+1);
});
}
if(e.keyCode === 13) {
//enter
e.preventDefault();
$scope.$apply(function() {
$scope.open($scope.activequestion+1);
});
}
if (e.keyCode == 9) {
//tab
e.preventDefault();
$scope.$apply(function() { $scope.open($scope.activequestion+1);
});
}
};
$element.on('keydown', handler);
$scope.$on('$destroy',function(){
$element.off('keydown', handler);
});
setTimeout(function() {
$scope.activequestion++;
$scope.$apply(function(){
$scope.open($scope.activequestion);
});
}, 2000);
};
return {
restrict: 'EA',
replace: true,
transclude: true,
link: ctrl,
template: '<div ng-transclude id="form-wrapper" class="answering"></div>'
};
});
**Ahora bien, lo que quiero es que partiendo de ese formulario, pueda yo almacenar esos datos y lo segundo es que al darle click en generar, eso genere un pdf con los datos ya suministrador o guardados.
Para los que me puedan ayudar, estaré full agradecido. Dios te bendiga!**