I'm working on a prototype in Rails 3 and ended up using some jquery (my first time and it's pretty sweet). Although, it appears that I am stuck when submitting the data from my view, which is from the Impromptu JQuery Survey, and into a my database (sqllite3). Let me explain how the page works:
- When a drop down item is selected the survey pops up. Also, this is a modal form and there's about 7 questions.
That's pretty much it. My desired outcome is after the user submits the form by clicking finish, each of the answered questions needs to do into the database. Some of the input fields are checkboxes and dropdowns.
Here is a sample of the code, from the last question of the survey:
state7: {
html:'Personality Type <div class="field"><select name="personality" id="rate_find"><option value="enfp">ENFP</option><option value="INTJ">INTJ</option><option value="ESTJ">ESTJ</option><option value="INTP">INTP</option></select></div>',
buttons: { Back: -1, Cancel: 0, Finish: 1 },
focus: 2,
submit: function(v, m, f){
if (v == 0)
$.prompt.close()
else
if (v == 1)
return true; //we're done
else
if (v = -1)
$.prompt.goToState('state6');//go back
return false;
}
}
}
$.prompt(temp,{
callback: function(v,m,f){
var str = "You can now process with this given information:<br />";
$.each(f,function(i,obj){
str += i + " - <em>" + obj + "</em><br />";
});
$.prompt(str)
}
});
}