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.
Product Version = NetBeans IDE 7.3 (Build 201302132200) Operating System = Linux version 3.2.0-38-generic running on amd64 Java; VM; Vendor = 1.7.0_15 Runtime = OpenJDK 64-Bit Server VM 23.7-b01 The following code is considered bogus: function createBasket() { if ($.trim($("#basket_label").val()) == '') { $("#basket_result").text('You must provide a label'); } else if ($("#basket_currency").find('option:selected').val() == '') { $("#basket_result").text('You must select a currency'); } else if (($.trim($("#basket_amount_max").val()) != '') && (isNaN(parseInt($("#basket_amount_max").val().replace(/ /g, ''))))) { $("#basket_result").text('Maximum amount must be a number'); } else { $("#basket_result").text(''); $("#basket_amount_max").val($("#basket_amount_max").val().replace(/ /g, '')); $.ajax({ type: 'POST', async: true, url: '/basket/0/save', data: $('#basket_form').serialize(), dataType: 'json', success: function(data) { if (typeof data.error != 'undefined') { if (data.error = 1) { $("#basket_result").text('This label already exists'); } } else { intBasketAmount = 0; intBasketMaxAmount = parseInt($("#basket_amount_max").val().replace(/ /g, '')); intBasketCurrency = parseInt($("#basket_currency").find('option:selected').val()); strBasketCurrency = $("#basket_currency").find('option:selected').attr('code'); $('#basket_new').dialog('close'); $('#basket_list').append('<option value="' + data.basket_id + '" selected="selected">' + $.trim($("#basket_label").val()) + '</option>').change(); } }, error: function(data) { $("#basket_result").text('An error occured. The form may be expired. Please, refresh'); } }); } An error is detected at "error: function(data) {". NetBeans indicates a comma is expected whereas this comma is present on previous line. This error is found in a Smarty compiled template (ie. a .tpl transformed and saved in Smarty "template_c" directory) but is not detected in the original .tpl file. This is a regretion, Netbeans 7.2 does not point this error.
seems to be caused by spanning string over multiple lines, placing \ at the end helps (not sure about the regexp). Reassigning to JavaScript
(In reply to comment #1) > seems to be caused by spanning string over multiple lines, placing \ at the end > helps (not sure about the regexp). Reassigning to JavaScript There is no string over multiple lines. The strings in this code are displayed with a carriage return in this ticket but there is no carriage return in the original source code. This is also true with: replace(/ /g, '')); which is in fact "replace(/ /g, ''));" in the source code. However, Netbeans shows an error at line: error: function(data) {
In NB 7.2 was used different parser - Rhino. In NB 7.3 we use Nashorn parser which is more strict than Rhino.
If it is still present attach the file as attachment so we can properly evaluate.
Created attachment 137626 [details] Smarty template making use of HighCharts to produce graph
I have a similar problem with javascript in a smarty template file where an error is reported that does not seem to be an error. The same file did not show an error in 7.2. snippet: title: { text: 'Comparison of Sales And Costs' }, xAxis: { categories: [ {foreach from=$results key=market item=res} '{ucwords(strtolower($market))}', {/foreach} ] }, yAxis: { min: 0, title: { text: 'Sales' }, stackLabels: { enabled: true, style: { fontWeight: 'bold', color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' } } }, The error is indicated on the second and fourth line under the "yAxis: {" line: @err title: { 'Sales' @err }, Expected ; but found: The project runs as expected. I include the code as an attachment I am using: Product Version: NetBeans IDE 7.3 (Build 201306052037) Java: 1.6.0_30; Java HotSpot(TM) Client VM 20.5-b03 Runtime: Java(TM) SE Runtime Environment 1.6.0_30-b12 System: Windows 7 version 6.1 running on x86; Cp1252; en_ZA (nb)
RichardPilks: Please report it as a new issue( JavaScript/Editor, use [1]), your problem seems to be different than this one. Thank you [1] https://netbeans.org/bugzilla/enter_bug.cgi?product=javascript