2017-06-13 18 views
0

私はこれらの2つの入力ボックスを持っているようです。Web App経由でFirebaseのデータベースにデータを保存中

<input type="button" id="valone"> 
    <input type="button" id="valuetwo"> 
    <button type="submit" onClick="submitB();" id="sbmtbtn"> 
    <script> 
    const firstval = findViewById="valueone"; 
    const secondval = findViewById="valuetwo"; 
    const submit = findViewById="sbmtbtn"; 

    const first = firstval.value; 
    const second = secondval.value; 

    function submitB() { 

    const firebaseRef = firebase.database().ref().push(); 

    firebaseRef.child("Value").child("Value One").set(first.value); 
    firebaseRef.child("Value").child("Value Two").set(second.value); 

       } 

しかし、それは.......

image of database please see

ようですが空白でない入力ボックス

の値は、すべての依存関係が設定されている私を助けてくださいこの画像を示しありません正しく動かされ、すべてがかなり上手くいく。

+0

'findViewById'は関数であると思いますか? –

答えて

0

HTML要素をルックアップしようとしていますが、存在しない関数を使用しています。次のようにgetElementById()を探しています:

<input type="button" id="valone"> 
<input type="button" id="valuetwo"> 
<button type="submit" onClick="submitB();" id="sbmtbtn"> 
<script> 
const firstElm = findElementById("valueone"); 
const secondElm = findElementById("valuetwo"); 
const submitBtn = findElementById("sbmtbtn"); 

const first = firstElm.value; 
const second = secondElm.value; 

function submitB() { 
    const firebaseRef = firebase.database().ref().push(); 

    firebaseRef.child("Value").child("Value One").set(first); 
    firebaseRef.child("Value").child("Value Two").set(second); 
} 
+0

申し訳ありませんがここで間違って入力しましたが、それはまた動作しません –

関連する問題