BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
arthurdpereira
Obsidian | Level 7

Hello everyone,

I created a form in SAS Viya V.03.05 using Job Execution (Studio), but when I place the style.css and script.js files separate from the HTML code, neither of them work.

Even using a library like Bootstrap does not work.

Am I doing something wrong, or does SAS not execute files outside the form?

I tried the following methods:

 

/SASJobExecution/?_program=/Public/JES/script.js
/SASJobExecution/?_program=/Public/JES/style.css
<link href="/SASJobExecution/?_program=/Public/JES/style.css" type="text/css" rel="stylesheet">
<link href="style.css" type="text/css" rel="stylesheet">
<script src="/SASJobExecution/?_program=/Public/JES/script.js"></script>
<script src="script.js"></script>

Could someone please help me?

1 ACCEPTED SOLUTION

Accepted Solutions
arthurdpereira
Obsidian | Level 7

DeMer, thanks for your help. You gave me more determination to keep insisting. And I did it.

I still don't know why, but the problem occurs that the .css file needs to have the <style></style> tag in the file. Example:

 

 

<style>
	body {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 100vh;
		background-color: #181c35;
		font-family: Arial, sans-serif;
	}
	/* Your CSS styles */
</style>

This way, the link created from the SASDrive URI recognizes as CSS:

 

 

 

<link href="/files/files/########/content" type="text/css" rel="stylesheet">

Thanks guys for all the support!

 

View solution in original post

18 REPLIES 18
arthurdpereira
Obsidian | Level 7

No, it doesn't work either. I had already tried that.

Kurt_Bremser
Super User

You must place the stylesheet and scriptfile in a location from where the web server (apache/httpd, not the web application server) can serve them, and use the corresponding web path as your href. Keep in mind that the browser is the place where everything has to come together.

arthurdpereira
Obsidian | Level 7
Thank you for the answer. That makes sense. How do I upload the file to the Apache/httpd server? Is there a reference link I can follow?
ChrisNZ
Tourmaline | Level 20

when I place the style.css and script.js files separate from the HTML code, neither of them work.

If that's an HTML page with existing css and js files, have you tried adding the file path?

 

<link href="/Public/JES/style.css" type="text/css" rel="stylesheet">

 

arthurdpereira
Obsidian | Level 7

No, it's not an .html file, but rather HTML written in the 'HTML form'. Do I need to create an HTML file and "link" to it?

arthurdpereira
Obsidian | Level 7
I tested it this other way and it still didn't work.
DeMer
Calcite | Level 5

Check out the section "Including a File in an HTML Form" in

  https://documentation.sas.com/api/docsets/jobexecug/v_002/content/jobexecug.pdf?locale=en

 

See if it works in V3.5.

arthurdpereira
Obsidian | Level 7

I tried to put everything in 'Including a File in an HTML Form', but it still didn't work

DeMer
Calcite | Level 5

Was there anything in the browser F12 console log? 

arthurdpereira
Obsidian | Level 7

Yes, it shows this error. But I don't know what this MIME is.

 

Error-Form-SAS.png

DeMer
Calcite | Level 5

Means that the CSS file has been stored in the File Service with a content type that is not text/css.

I think the easiest way in V3.5 is to import the files using SAS Drive.  It will set the MIME type based on the file type in the file name e.g.  myfile.css.

arthurdpereira
Obsidian | Level 7

I tried every way, with and without the extension name; putting '/SASJobExecution?_FILE=/Public/JES/style.css'; '/SASJobExecution?_FILE=/Public/JES/style'; 'files/files/4341684f-d65e-4760-af63-5b8123b0a370/content'', but I couldn't find it in any of them...Error-Form-SAS-02.png

The strangest thing is that SAS recognizes the file format, but it still gives this type of error.

DeMer
Calcite | Level 5

Can you see the file characteristics in a browser with a URL like

     http://yoursystem/files/files/4341684f-d65e-4760-af63-5b8123b0a370

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 18 replies
  • 565 views
  • 1 like
  • 4 in conversation