2017-11-03 7 views
0

私のウェブサイトにGoogleフォームがあり、その外観を変更したいと考えています。私はそうするための説明を見つけたhere。それぞれのコードを以下に示します。また、here(CSSと結果を参照)も表示されます。htmlと個別の確認ページのあるGoogleフォーム

私は自分の確認ページ(mywebsite.com/signup-confirmation)を持っています。 A commentは、以下の方法でそれを記述していますが、これらの変更を正確に行う場所はわかりません。

フォームが新しいページにリダイレクトされないようにする。私は、フォームに追加し、 ターゲット=「無ターゲット」すると

私は、IFRAMEはiframe srcを作成していない=「#」ID =「ノー・ターゲット」 名=「無ターゲット」スタイル= "可視性:隠されました「> </iframeの

今すぐフォームdoesntのuはjavascriptのwindow.location.assign( window.location.hostnameと、URLの場所 を変更することができ提出にリダイレクトすること;リダイレクトされます

^ホームページへ

ウェブサイトの例から

コード:フォームタグに

<script type="text/javascript">var submitted=false;</script> 
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {window.location='/thanks.html';}"></iframe> 

そして、この:

<header> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <link rel="stylesheet" href="css-signup.css"> 

    <div class="wrapper"> 
    <!-- TITLE YOUR FORM --> 
    <h1>Health Survey</h1> 
    <h2>Diagnostic for applicants to our fitness program.</h2> 
    </div> 
</header> 

<section> 
    <div class="wrapper"> 
    <!-- START CODING YOUR FORM --> 
    <form action="https://docs.google.com/a/ladieslearningcode.com/forms/d/e/1FAIpQLSddBVO983YSbAXB7yWkg9Z69CyrY8AAQvUjlhJWtm-7LvdOpQ/formResponse"> 

    <!-- MUTLIPLE CHOICE --> 
    <p>How often do you exercise?</p> 
    <div class="input-wrap"><input type="radio" name="entry.1177013199" id="e1" value="1 day a week"/> 
    <label for="e1">1 day a week</label></div> 
    <div class="input-wrap"><input type="radio" name="entry.1177013199" id="e2" value="2-3 days a week"/> 
    <label for="e2">2-3 days a week</label></div> 
    <div class="input-wrap"><input type="radio" name="entry.1177013199" id="e3" value="4-5 days a week"/> 
    <label for="e3">4-5 days a week</label></div> 
    <div class="input-wrap"><input type="radio" name="entry.1177013199" id="e4" value="6+ days a week"/> 
    <label for="e4">6+ days a week</label></div> 

    <!-- CHECKBOXES --> 
    <p>Do you have any food allergies?</p> 
    <div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a1" value="Milk"/> 
    <label for="a1">Milk</label></div> 
    <div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a2" value="Eggs"/> 
    <label for="a2">Eggs</label></div> 
    <div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a3" value="Peanuts"> 
    <label for="a3">Peanuts</label></div> 
    <div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a4" value="Wheat"> 
    <label for="a4">Wheat</label></div> 
    <div class="input-wrap"><input type="checkbox" name="entry.359931602" id="a5" value="Soy"> 
    <label for="a5">Soy</label></div> 

    <!-- DROPDOWN --> 
    <p>What is your favourite food group?</p> 
    <div class="input-wrap select-box"> 
     <select name="entry.1781742467"> 
     <option selected disabled>Choose</option> 
     <option value="Fruit">Fruit</option> 
     <option value="Vegetables">Vegetables</option> 
     <option value="Grain">Grain</option> 
     <option value="Meat">Meat</option> 
     <option value="Dairy">Dairy</option> 
     </select> 
    </div> 

    <!-- SINGLE LINE TEXT FIELD --> 
    <label for="comfort">What is your go-to comfort food?</label> 
    <input name="entry.1169089770" type="text" id="comfort"/> 

    <!-- MULTI-LINE TEXT FIELD --> 
    <label for="explain">Explain why you want to improve your physical health.</label> 
    <textarea name="entry.1175247585" id="explain"/></textarea> 

    <!-- LINEAR SCALE "SLIDER" --> 
    <label for="explain">Rate your current physical health.</label> 
    <input name="entry.1672382864" type="range" min="1" max="5" step="1"> 

    <!-- DATE INPUT --> 
    <label for="explain">When are you available to start training?</label> 
    <input name="entry.246017384" type="date"> 

    <!-- TIME INPUT --> 
    <label for="explain">What time of day is best to connect?</label> 
    <input name="entry.1990206646" type="time"> 

    <!-- SUBMIT BUTTON --> 
    <input class="button" type="submit" value="Submit"> 
    </form> 
</div> 

答えて

0
あなたのformタグの前にコードのこの部分を追加する必要があり

target="hidden_iframe" onsubmit="submitted=true;" 

すべてが一緒に見えるこれ(例):

<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {window.location='/thanks.html';}"></iframe> 

<form class="form" action="LINK" method="POST" target="hidden_iframe" onsubmit="submitted=true;"> 
    <label>Insert label</label> 
    <input name="entry.xxx" type="text" required /> 
    <input type="submit" value="Submit" /> 
</form> 
関連する問題