This error appears when saving (editing) the news. The php file does not know how to show. He is pretty not small.

SyntaxError: expected expression, got '<' 

Maybe there is a mistake somewhere.

  $script .= "if(document.entryform.short_story.value == '' || document.entryform.title.value == ''){ alert('$lang[add_err_7]'); } if( $config['allow_site_wysiwyg'] == "yes" ) $script .= "<form method=post name=\"entryform\" id=\"entryform\" onsubmit=\"document.getElementById('short_story').value = tinyMCE.get('short_story').getContent(); document.getElementById('full_story').value = tinyMCE.get('full_story').getContent(); if(document.entryform.title.value == '' || document.entryform.short_story.value == ''){alert('$lang[add_err_7]');return false}\" action=\"\">"; else $script .= "<form method=post name=\"entryform\" id=\"entryform\" onsubmit=\"if(document.entryform.title.value == '' || document.entryform.short_story.value == ''){alert('$lang[add_err_7]');return false}\" action=\"\">"; 
  • besides this message there should be an indication of the line where it happened, well, this line itself is actually needed - Grundy
  • Nothing more is written - steep
  • where do you see this error? - Grundy
  • In the console, there is still a TypeError: document.entryform.short_story is undefined - steep
  • To the right of the error text is the line in the code on which this error occurred - Grundy

2 answers 2

first line

$ script. = "if (document.entryform.short_story.value == '' || document.entryform.title.value == '') {alert ('$ lang [add_err_7]');}

change to

$ script. = "if (document.entryform.short_story.value == '' || document.entryform.title.value == '') {alert ('$ lang [add_err_7]');}";

  • The quote is closed a little further $script .= "if(document.entryform.short_story.value == '' || document.entryform.title.value == ''){ alert('$lang[add_err_7]'); }; else{ dd=window.open('','prv','height=400,width=750,resizable=0,scrollbars=1') document.entryform.mod.value='preview';document.entryform.action='{$config['http_home_url']}engine/preview.php';document.entryform.target='prv' document.entryform.submit();dd.focus() setTimeout(\"document.entryform.mod.value='addnews';document.entryform.action='';document.entryform.target='_self'\",500) } }"; - steep
  • @steep in the code given in the question, you have an error because of this climbs if( $config['allow_site_wysiwyg'] == "yes" ) $script .= "<form method=post , specifically in the place = "<form you close the quotes and then go the bare code <form ... without assignment to any variable. - Alex
  • @steep and the code you specify in the comment to the answer is different from the code you specified in the question. We recommend updating the issue to include problem files in it, because without this, it is very difficult to help you. - Alex

The closing quotation was skipped in the first line

 $script .= "if(document.entryform.short_story.value == '' || document.entryform.title.value == ''){ alert('$lang[add_err_7]'); }"; if( $config['allow_site_wysiwyg'] == "yes" ) { $script .= "<form method=post name=\"entryform\" id=\"entryform\" onsubmit=\"document.getElementById('short_story').value = tinyMCE.get('short_story').getContent(); document.getElementById('full_story').value = tinyMCE.get('full_story').getContent(); if(document.entryform.title.value == '' || document.entryform.short_story.value == ''){alert('$lang[add_err_7]');return false}\" action=\"\">"; } else { $script .= "<form method=post name=\"entryform\" id=\"entryform\" onsubmit=\"if(document.entryform.title.value == '' || document.entryform.short_story.value == ''){alert('$lang[add_err_7]');return false}\" action=\"\">"; }