I need to validate a form using JSP... can i have something like this on my .js file??? else if (isNaN(num) || num==null || num == '' || num><?php echo $maxsize; ?>) Code (markup): I do have server permitions but this is for an aplication that will be installed somwhere else, so i cant go and just add .js on the php compile extenssions list.
I don't think you can. Servers won't parse JS files with PHP unless you modify your server settings to do so... and then if you do, it's going to parse the JS file, all of it, so it wouldn't work then either
Hmmm... why not name your JS file as .php and do it that way? So long as your browsers know which file to grab for the script (and so long as they know what language it's in, as defined in the <script> tag) you shouldn't have a problem: the browsers won't care what the extension is!
cause i want to set a maximum value of a field to a php variable value.... this way i dont need to parse variables from place to place
Right... and so the problem is what, exactly? You want to do what you stated at the top of the page, but you're saying that you can't get PHP to parse your .js file. I'm telling you to rename your .js file to .php and it should work as you want, so long as instead of your HTML pointing to the .js file, it points to the .php file. Or have I totally missed something here?