I am using valums file uploader. But I want to initiate a checkbox, to disable the upload button if user hasnt checked it.
I can get it working in a regular form, but not using valums because I think, he uses div elements as form attributes.. so I am guessing I have screwed my code up.
In html I have:
<form class="well">
<label>Upload a Single File</label>
<label class="checkbox">
<input id="tos" onclick="if(this.checked){this.form.qq-upload-button.disabled=false}else{this.form.qq-upload-button.disabled=true};this.blur();" checked="" value="1" name="tos" type="checkbox"> I have read and agree to the <a href="/tos">TOS</a>
</label>
<div id="file-uploader-demo1">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
<!-- or put a simple form for upload here -->
</noscript>
</div>
</form>
In fileuploader.js ( valums code I have )
template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
'<div class="qq-upload-button btn btn-primary left">Upload a file</div><span class="help-inline"> Lets Do it!</span>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
Can you spot what I have cocked up ?
Essentially, I wish to disable upload button if user has not checked the checkbox.
For a regular form, this code works:
<form class="well">
<label>Upload a Single File</label>
<input type="file" class="span3" placeholder="Click Here">
<span class="help-inline">Associated help text!</span>
<label class="checkbox">
<input id="tos" onclick="if(this.checked){this.form.btn.disabled=false}else{this.form.btn.disabled=true};this.blur();" checked="" value="1" name="tos" type="checkbox"> I have read and agree to the <a href="/tos">TOS</a>
</label>
<input name="btn" type="submit" class="btn btn-primary left" value="UPLOAD">
</form>