• User Attivo

    Aggiungi evento di controllo campo testo

    Salve a tutti, avrei un problema sulla validazione del campo testo in quanto nel form che sto usando non è presente direttamente il tasto "submit" e quindi non so come integrare nella forma classica il controllo del campo!!!.....questo il codice della pagina:

    [html]

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>File Upload</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="mootools-1.2-core-nc.js"></script>
    <script type="text/javascript" src="Swiff.Uploader.js"></script>
    <script type="text/javascript" src="Fx.ProgressBar.js"></script>
    <script type="text/javascript" src="FancyUpload2_DE.js"></script>
    <script type="text/javascript">
    /* <![CDATA[ */

    window.addEvent('load', function() {
    document.getElement('b').appendText(' Detected Flash ' + Browser.Plugins.Flash.version + '!');

    var swiffy = new FancyUpload2($('demo-status'), $('demo-list'), {
        debug: true,
        url: $('form-demo').action,
        data: $('form-demo'),
        fieldName: 'photoupload',
        path: 'Swiff.Uploader.swf',
        limitSize: 1150 * 1024 * 1024,
        target: 'demo-browse',
        onLoad: function() {
            $('demo-status').removeClass('hide');
            $('demo-fallback').destroy();
        }
    
    });
        $('demo-select-images').addEvent('change', function() {
        var filter = null;
        if (this.checked) {
            filter = {'Images (*.jpg, *.jpeg, *.gif, *.png)': '*.jpg; *.jpeg; *.gif; *.png'};
        }
        swiffy.options.typeFilter = filter;
    });
    $('demo-browse').addEvent('click', function() {
        swiffy.browse();
        return false;
    });
    
    $('demo-clear').addEvent('click', function() {
        swiffy.removeFile();
        return false;
    });
    
    $('demo-upload').addEvent('click', function() {
        swiffy.upload();
        return false;
    });
    

    });

    </script>
    <script type="text/javascript" src="common.js"></script>

    </head>
    <body bgcolor="#333333" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="add_handlers('load','cancella','go');">
    <div align="center">
    <table width="100%" height="162" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td class="header-bg"> </td>
    <td width="600" height="162" valign="bottom" background="http://www.giorgiotave.it/forum/images/header.gif" class="topmenu"> <div align="right">
    <table width="600" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="200"></td>
    <td width="200"><div align="center" class="footer5"><b></b></div></td>
    <td width="200"><div align="right"><a href="guida.html" target="_parent" class="Stile1"><strong>Guida (?)</strong></a></div></td>
    </tr>
    </table>
    <strong></strong></div></td>
    <td class="header-bg"> </td>
    </tr>
    </table>
    </div>
    <table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#333333">
    <tr>
    <td> <form action="script.php?<?= $append ?>" method="post" enctype="multipart/form-data" id="form-demo" >
    <fieldset id="demo-fallback">
    <label for="demo-photoupload">
    <input type="file" name="photoupload" id="demo-photoupload" />
    </label>
    </fieldset>
    <div id="demo-status" class="hide">
    <input type="checkbox" id="demo-select-images" />
    Solo immagini
    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="195"><div id="demo-browse" class="scegli"><a href="#" id="load"><img src="http://www.giorgiotave.it/forum/images/load.gif" id="load_img" alt="" /></a></div></td>
    <td width="185"><div id="demo-clear" class="clear"><a href="#" id="cancella"><img src="http://www.giorgiotave.it/forum/images/cancella.gif" id="cancella_img" alt="" /></a></div></td>
    <td width="120"><div id="demo-upload" class="invia"><a href="#" id="go"><img src="http://www.giorgiotave.it/forum/images/go.gif" id="go_img" alt="" /></a></div></td>
    </tr>
    </table>
    <br /><br />
    <div>
    <strong class="overall-title">Dimensione Totale (0 kB)</strong><br />
    <img src="http://www.giorgiotave.it/forum/images/bar.gif" class="progress overall-progress" />
    </div></br>
    <div>
    <strong class="current-title">Invio</strong><br />
    <img src="http://www.giorgiotave.it/forum/images/bar.gif" class="progress current-progress" />
    </div>
    <div class="current-text"></div><br>
    <ul id="demo-list"></ul>
    </div><div><INPUT TYPE=TEXT NAME="nome" size=30 id="nome">
    </div>
    </form> </td>
    </tr>
    </table>

    </div>

    </body>
    </html>

    [/html]Grazie...un saluto a tutti


  • User

    Ciao, forse potresti utilizzare l'evento onfocusout, che viene richiamato quando il cursore esce dal campo in cui si trova ed effettuare la validazione "in tempo reale" ...