Last active
October 28, 2017 17:02
-
-
Save ssbreno/40321ef8312bf096bc50aa772443ffeb to your computer and use it in GitHub Desktop.
Google Forms - Condition Choice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author : Breno Sobral | |
// Using Google Forms Docs | |
function CreateFormChoice() { | |
// Create a new form and add a multiple-choice item. | |
var title = 'Pesquisa sobre mobilidade urbana'; | |
var description = ('Pesquisa de Levantamento de dados para Projeto Final de Breno Sobral'); | |
var form = FormApp.create(title) | |
.setDescription(description) | |
.setConfirmationMessage('Obrigado pela resposta!'); | |
var final = FormApp.PageNavigationType.SUBMIT; | |
var img = UrlFetchApp.fetch('http://gr21.com.br/wp-content/uploads/2017/08/58dd361c95d94.jpg'); | |
form.addImageItem() | |
.setImage(img); | |
var item = form.addMultipleChoiceItem(); | |
item.setTitle('Você possui carro ?') | |
.setChoices([ | |
item.createChoice('Sim', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Não', final) | |
]); | |
form.addPageBreakItem().setTitle('Ótimo, vamos fazer uma pequena pesquisa.'); | |
var item = form.addMultipleChoiceItem(); | |
item.setTitle('Qual o tempo médio para achar uma vaga em um estacionamento de um Shopping ?') | |
.setChoices([ | |
item.createChoice('Em menos de cinco minutos', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Mais de cinco minutos', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('As vezes, não consigo encontrar.', FormApp.PageNavigationType.CONTINUE) | |
]); | |
form.addPageBreakItem(); | |
var item = form.addMultipleChoiceItem(); | |
item.setTitle('Como você qualifica os estacionamentos onde você estaciona ?') | |
.setChoices([ | |
item.createChoice('Ruim', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Bom', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Excelente', FormApp.PageNavigationType.CONTINUE) | |
]); | |
form.addPageBreakItem(); | |
var item = form.addMultipleChoiceItem(); | |
item.setTitle('Você recorda o nome da empresa que administra o estacionamento onde você estaciona ?') | |
.setChoices([ | |
item.createChoice('Sim', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Não', FormApp.PageNavigationType.CONTINUE) | |
]); | |
form.addPageBreakItem().setTitle('Já esta quase acabando :D.'); | |
var item = form.addMultipleChoiceItem(); | |
item.setTitle('Qual o tempo médio para achar uma vaga no centro de sua cidade ?') | |
.setChoices([ | |
item.createChoice('Em menos de cinco minutos', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Mais de cinco minutos', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('As vezes, não consigo encontrar', FormApp.PageNavigationType.CONTINUE) | |
]); | |
form.addPageBreakItem(); | |
var item = form.addMultipleChoiceItem(); | |
item.setTitle('Já deixou de sair de casa com carro por não ter onde estacionar ?') | |
.setChoices([ | |
item.createChoice('Sim', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Não', FormApp.PageNavigationType.CONTINUE) | |
]); | |
form.addPageBreakItem().setTitle('Obrigado pela contribuição, suas respostas irão me ajudar muito.'); | |
var item = form.addMultipleChoiceItem(); | |
item.setTitle('Você agendaria uma vaga em um estacionamento por aplicativo ?') | |
.setChoices([ | |
item.createChoice('Sim', FormApp.PageNavigationType.CONTINUE), | |
item.createChoice('Não', FormApp.PageNavigationType.CONTINUE) | |
]); | |
// Log the navigation types that each choice results in. | |
var choices = item.getChoices(); | |
for (var i = 0; i < choices.length; i++) { | |
Logger.log('If the respondent chooses "%s", the form will %s.', | |
choices[i].getValue(), | |
choices[i].getPageNavigationType()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compile using Google Script Editor