This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 204040

Summary: javascript / php marked as a error and wrong identation
Product: php Reporter: montblack
Component: EditorAssignee: Petr Pisl <ppisl>
Status: RESOLVED INVALID    
Severity: normal Keywords: PLATFORM
Priority: P3    
Version: 7.0.1   
Hardware: PC   
OS: Windows Vista   
Issue Type: DEFECT Exception Reporter:

Description montblack 2011-10-20 20:51:22 UTC
Product Version = NetBeans IDE 7.0.1 (Build 201109201739)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.6.0_25
Runtime = Java HotSpot(TM) Client VM 20.0-b11

i got this php code:

\\-----------------------------------------------------------------------------
<script type="text/javascript">
<?php include_once 'errorAdmin_res.php'; ?>
    function valid(data){
        try{
            var _msg = "";
            if (typeof data.val == "undefined"){
                data.val = $("#"+data.id).children("#val").val();
                if(typeof data.evento != "undefined" ){
                    evt = data.evento;
                    evt = (evt) ? evt : event; 
                    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); 
                    data.val += String.fromCharCode(charCode); 
                }
            }
            switch(data.tipo){
                default:
                    return "";
                    break;
<?php foreach ($metadatos as $key => $value) { ?> 
                        case '<?php echo $key; ?>':
    <?php if (!$value["null"]) { ?>
                                if (data.val == "") {
                                    _msg += "&#9737; El Campo no debe estar vacio<br/>";
                                }
    <?php } ?>
                            if (data.val != "") {
                                <php if (strlen($value["formato"][0]) > 0) {$a = 10;?><?php } ?>
                                                            if (!<?php echo $value["formato"][0]; ?>.test(data.val) && _msg=="") 
                                                            _msg += "&#9737; Formato Incorecto! <?php echo $value["formato"][1]; ?> <br/> ";
                                                        }
                                                        break; 
<?php } ?>
                    
                    }
                    if(_msg != ""){
                        printError({id: data.id, msg: _msg});
                        return false;
                    }else{
                        if($("#"+data.id).children("#err").length>0)
                            $("#"+data.id).children("#err").remove();
                        return true;
                    }
                }catch(e){
                    if(<?php echo $alertError; ?>) alert(e);
                }
            }
</script>
\\-------------------------------------------------------------------------------------
and ide mark many lines as a error but this is not an error and i press ALT+ENTER and dont show me any sugestion

pd: sorry gor my english i speak spanish
Comment 1 Petr Pisl 2011-10-21 11:16:58 UTC
I expect that the code is in a php file. I'm right?
Comment 2 Petr Pisl 2011-10-21 11:23:05 UTC
I have just noticed that there is missing question mark in one open php delimiter. When i correct it from:

<php if (strlen($value["formato"][0]) > 0) {$a = 10;?><?php } ?>

to 

<?php if (strlen($value["formato"][0]) > 0) {$a= 10;?><?php } ?>

then it start to work correctly. 

Please reopen, if it's not the reason. Thanks.