我想禁用我的提交按鈕,直到所有的字段有值的所有投入。我怎樣才能做到這一點?在形式上,我有一個選擇,文件,日期選擇器和文本輸入..禁用啓用提交按鈕 - 禁用,直到所有領域都值 - HTML表單檢查答案
我有這些例子,但我不能使它工作。
Https://jsfiddle.net/xG2KS/485/
Http://jsfiddle.net/soyn0xag/6/
HTML:
<form class="myForm" id="form">
<div id= "select_input" name="select1">
<select name="select1">
<option disabled selected>Unidade:</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="input-field">
<span class="gbp">
<input id= "value_input" name="value" type="number" min="0" max="10000" step="0.05" /><br/>
<label> value:</label>
</span>
</div>
<div class="input-field">
<label for="date">date</label>
<input id="date_input" class="datepicker" name="date" type="text">
</div>
<div class="input-field">
<input id="email_input" name="email" type="email" /><br/>
<label for="email" >Email</label>
</div>
<div class="input-field ">
<textarea id= "text_input" name="text" class="materialize-textarea" data-length="500"></textarea>
<label for="text">Long Text.</label>
</div>
<div class="file-field input-field">
<div class="btn">
<span>File</span>
<input id= "myFile_input" name="myFile" type="file" accept="image/*" capture="camera" id="camera" >
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" >
</div>
</div>
<button type="button" value="Upload" class="btn waves-effect waves-light" id="submit" onclick="toggle_visibility('formDiv'); toggle_visibility('inProgress'); google.script.run .withSuccessHandler(updateOutput) .processForm(this.parentNode)">Submit </button>
</form>
對不起,但我不明白如何使用它。你可以給我一個例子嗎?謝謝! –
謝謝! textarea字段在這種情況下不起作用。我嘗試過: 'AllInputs = document.getElementsByTagName(「INPUT」,「TEXTAREA」);' 它也沒有工作。你能幫助我嗎? –
查看textarea的更新內容 –