Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Dumb javascript form question

  • 23-11-2012 9:31pm
    #1
    Registered Users, Registered Users 2 Posts: 19,309 ✭✭✭✭


    I'm trying to set up an uploadthingy image submission form, but have run up against a problem with the javascript (knowledge=zilch). I'm fine with the standard text fields in the form, but I'd like to have a dropdown form, and a either/or radio button option in there too. I've rigged up a test page with operational text fields, but a non-working dropdown:

    http://www.hexhibit.com/Archive-test-2/test-form.html

    The code for the pulldown was butchered from a different form, and I've done a half-assed job of trying to crowbar it in to this, but without success - can anyone point me in the right direction? Here's the code:
    <script src="http://49video.resources.s3.amazonaws.com/uploadthingy.js" type="text/javascript" language="Javascript"></script>
    <iframe id="uploadtarget" name="uploadtarget" src="" style="width:0px;height:0px;border:0"></iframe>
    <div id='uploadarea'><p><img src=http://49video.resources.s3.amazonaws.com/loading.gif width=16 height=16>  Loading <a href=http://www.uploadthingy.com>Uploadthingy file upload form</a>... <br><br>If your upload form doesn't display within a few seconds, please check the <a href=http://www.uploadthingy.com/faq.html>FAQ</a> or contact us at hello@uploadthingy.com. We'd love to help out!</p></div>
    <script type="text/javascript" language="Javascript">
    var sitecode="aGV4aGliaXQuY29t";
    authupload();
    function getUploadForm(json) {
    showblinks=false;
    var SECTOR=new Array("Architecture", "Circus", "Dance", "Film", "Literature", "Music", "Opera", "Street arts and spectacle", "Theatre", "Traditional arts", "Visual arts", "Artists supports", "Arts participation", "Festivals and events", "Local arts", "Venues", "Young people, children and education");
    var h="";
    h+="Artform or subject of image<br><select style='width:400px;' id='uploader_artssector'>";
            for (var i=0; i<SECTOR.length; i++) h+="<option value='"+SECTOR[i]+"'>"+SECTOR[i];
    		h+="</select><br><br>";
    h+="<p style='color:gray;'>Your name *<br>";
    h+="<input type=text style='width:500px;' id='uploader_name' name='uploader_name'></p>";
    h+="<p style='color:gray;'>Your organisation *<br>";
    h+="<input type=text style='width:500px;' id='uploader_organisation' name='uploader_organisation'></p>";
    h+="<p style='color:gray;'>How we can contact you *<br>";
    h+="<textarea style='width:500px; height:100px;' id='uploader_contact' name='uploader_contact'></textarea></p>";
    h+="<p style='color:gray;'>Image details<br>";
    h+="<textarea style='width:500px; height:100px;' id='uploader_description' name='uploader_description'></textarea></p>";
    h+="<p style='color:gray;'>Image file<br>";
    h+="<input type='file' size='40' id='uploadfile0' name='file0'><br>";
    h+="</p>";
    h+="<input type='hidden' id='authcode' name='authcode' value='"+json.c+"'>";
    h+="<input type='hidden' id='uploadid' name='id' value='widget$"+json.d+"$"+json.c.substring(0,json.c.indexOf("_"))+"'>";
    h+="<input type='hidden' id='callbackurl' name='callbackurl' value='"+baseserverurl+"'>";
    h+="<input type='hidden' name='savemeta' value='yes'>";
    h+="<p><input class='widget_button' id='49widget_submitbutton' type='button' onclick='doUpload();' name='suploadvideo' value='Upload'></p>";
    return h;
    }
    function doUpload() { if (checkform()) { upload('start'); } }
    function checkform() { 
    var found=false;
    var cnt=0;
    while (document.getElementById('uploadfile'+cnt)) {
    if (document.getElementById('uploadfile'+cnt).value.length>0) {
    found=true;
    break;
    }
    cnt++;
    }
    if (!found) {
    alert('Please select at least one file to upload.');
    return false;
    }
    if (document.getElementById('uploader_name').value.length==0) {
    alert('Please fill out the field: Your name.');
    return false;
    }
    if (document.getElementById('uploader_organisation').value.length==0) {
    alert('Please fill out the field: Your organisation.');
    return false;
    }
    if (document.getElementById('uploader_contact').value.length==0) {
    alert('Please fill out the field: How we can contact you.');
    return false;
    }
    uploadmetadata=new Array();
    uploadmetadata['artssector']=document.getElementById('uploader_artssector').value;
    uploadmetadata['name']=document.getElementById('uploader_name').value;
    uploadmetadata['company']=document.getElementById('uploader_organisation').value;
    uploadmetadata['contact']=document.getElementById('uploader_contact').value;
    uploadmetadata['description']=document.getElementById('uploader_description').value;
    uploadmetadata['uploadfile0']=document.getElementById('uploadfile0').value;
    	return true;
    }
    </script>
    


Comments

  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    What is the problem. The test page drop down seems to work fine!


  • Registered Users, Registered Users 2 Posts: 19,309 ✭✭✭✭alastair


    What is the problem. The test page drop down seems to work fine!

    The drop down looks fine - but it's not submitting - unlike the rest of the text fields. :(


  • Registered Users, Registered Users 2 Posts: 19,309 ✭✭✭✭alastair


    I've had thsi sorted by the uploadthingy people, but then added extra form fields and banjaxed it again - waiting to hear back from them on correcting my mistakes.

    cheers.


Advertisement