public static function insertForm($fields, $from_location, $titles=false) {
        echo('<form method="post">'."\n");

        for($i=0; $i < count($fields); $i++ ) {
            $field = $fields[$i];

            // Don't allow setting of these fields
            if ( strpos($field, "_at") > 0 ) continue;
            if ( strpos($field, "_sha256") > 0 ) continue;

            echo('<div class="form-group">'."\n");
            echo('<label for="'.$field.'">'.self::fieldToTitle($field, $titles)."<br/>\n");

            if ( strpos($field, "secret") !== false ) {
                echo('<input id="'.$field.'" type="password" autocomplete="off" size="80" name="'.$field.'"');
                echo("onclick=\"if ( $(this).attr('type') == 'text' ) $(this).attr('type','password'); else $(this).attr('type','text'); return false;\">\n");
            } else {
                echo('<input type="text" size="80" id="'.$field.'" name="'.$field.'">'."\n");
            }
            echo("</label>\n</div>");
        }

        echo('<input type="submit" name="doSave" class="btn btn-normal" value="'._m("Save").'">'."\n");
        echo('<a href="'.$from_location.'" class="btn btn-default">Cancel</a>'."\n");
        echo('</form>'."\n");
    }