嗨,我有这样的HTML表单:
<form id="msform" action="https://forms.hubspot.com/uploads/form/v2/5435007/bb741987-d401-482b-86b3-13ebf0405ec4" method="post">
<img class="logo" src="https://cdn2.hubspot.net/hubfs/5435007/ZenMaster/cos-logo.jpg" alt="COS logo">
<input type="email" id="mail" name="email" value="{{request.query_dict.email}}">
<input type="hidden" id="something" name="hs_context" value="">
<fieldset>
<legend><span class="number">4</span>Section 4 (4/5)</legend>
<h2>Do you have a COS Account Manager? (Your account manager is your primary sales contact at COS)</h2>
<label>1. My account manager is exceptional at providing solutions to my business problems:</label>
<input type="radio" id="radio_s4_01" value="Strongly Disagree" name="my_account_manager_is_exceptional"><label for="radio_s4_01" class="light">Strongly Disagree</label>
<input type="radio" id="radio_s4_02" value="Slightly Disagree" name="my_account_manager_is_exceptional"><label for="radio_s4_02" class="light">Slightly Disagree</label>
<input type="radio" id="radio_s4_03" value="Disagree" name="my_account_manager_is_exceptional"><label for="radio_s4_03" class="light">Disagree</label>
<input type="radio" id="radio_s4_04" value="Neutral" name="my_account_manager_is_exceptional"><label for="radio_s4_04" class="light">Neutral</label>
<input type="radio" id="radio_s4_05" value="Slightly Agree" name="my_account_manager_is_exceptional"><label for="radio_s4_05" class="light">Slightly Agree</label>
<input type="radio" id="radio_s4_06" value="Strongly Agree" name="my_account_manager_is_exceptional"><label for="radio_s4_06" class="light">Strongly Agree</label>
<label for="bio">7. Other:</label>
<textarea id="bio" name="other_section_5"></textarea> <br>
<input type="button" name="previous" class="previous action-button" value="Previous" />
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
<!---------------------------------------- Section 5 --------------------------->
<fieldset>
<legend><span class="number">6</span>Section 6 (6/6)</legend>
<label for="bio">1. How likely are you to recommend COS to a colleague or friend?</label>
<textarea id="bio" name="how_likely_are_you_to_recommend"></textarea>
<label for="bio">2. What are your reasons for giving that score?</label>
<textarea id="bio" name="what_are_your_reasons_for_giving_that_score"></textarea>
<label for="bio">3. What ONE THING (if any) should COS START doing right now?</label>
<textarea id="bio" name="what_one_thing_if_any_should"></textarea>
<label for="bio">4. What ONE thing (if any) should COS STOP doing right now?</label>
<textarea id="bio" name="one_thing_if_any_should_cos_stop"></textarea>
<label for="bio">5. What is COS' single greatest STRENGTH?</label>
<textarea id="bio" name="cos_single_greatest_strength"></textarea>
<label for="bio">6. What is COS' single greatest WEAKNESS?</label>
<textarea id="bio" name="cos_single_greatest_weakness"></textarea>
<label for="bio">7. Lastly, do you have any advice or feedback to give to the COS General Manager?</label>
<textarea id="bio" name="lastly_do_you_have_any_advice"></textarea>
<input type="button" name="previous" class=" previous action-button" value="Previous" />
<input type="submit" value="Submit" class="action-button" />
</fieldset>
</form>
我有一段JavaScript,可以创建多步骤表单,但是提交后我试图使其重定向到另一个页面,但是我被卡住了,我试图使用window.location但没有用,这里是整个js:
$(function() {
//jQuery time
var current_fs, next_fs, previous_fs; //fieldsets
var left, opacity, scale; //fieldset properties which we will animate
var animating; //flag to prevent quick multi-click glitches
$(".next").click(function(){
if(animating) return false;
animating = true;
current_fs = $(this).parent();
next_fs = $(this).parent().next();
//activate next step on progressbar using the index of next_fs
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
//show the next fieldset
next_fs.show();
//hide the current fieldset with style
current_fs.animate({opacity: 0}, {
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale current_fs down to 80%
scale = 1 - (1 - now) * 0.2;
//2. bring next_fs from the right(50%)
left = (now * 50)+"%";
//3. increase opacity of next_fs to 1 as it moves in
opacity = 1 - now;
current_fs.css({'transform': 'scale('+scale+')'});
next_fs.css({'left': left, 'opacity': opacity});
},
duration: 800,
complete: function(){
current_fs.hide();
animating = false;
},
//this comes from the custom easing plugin
easing: 'easeInOutBack'
});
});
$(".previous").click(function(){
if(animating) return false;
animating = true;
current_fs = $(this).parent();
previous_fs = $(this).parent().prev();
//de-activate current step on progressbar
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
//show the previous fieldset
previous_fs.show();
//hide the current fieldset with style
current_fs.animate({opacity: 0}, {
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale previous_fs from 80% to 100%
scale = 0.8 + (1 - now) * 0.2;
//2. take current_fs to the right(50%) - from 0%
left = ((1-now) * 50)+"%";
//3. increase opacity of previous_fs to 1 as it moves in
opacity = 1 - now;
current_fs.css({'left': left});
previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity});
},
duration: 800,
complete: function(){
current_fs.hide();
animating = false;
},
//this comes from the custom easing plugin
easing: 'easeInOutBack'
});
});
$(".submit").click(function(){
return false;
})
//end of line
});
有人可以为此建议一个好的解决方案吗?我没有使用任何服务器端代码来执行任何操作,只是简单地使用前端脚本来处理任务
答案 0 :(得分:0)
更改表单的操作网址:
$("#msform").attr("action", "<<<<new action>>>>>");
$("#msform").submit();