SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Accepted Solution Solved
Reply
Contributor SGB
Contributor
Posts: 41
Accepted Solution

SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Hi SAS-perts!

I am engaged in helping my organization to develop UI using SAS stored Processes in SAS EG.

I am a good SAS programmer with limited knowledge on SAS stored process and know nothing about HTML code/ JavaScript.

I need to create a pop-up-calender. I came across a webpage with HTML code for pop up calender. http://www.roseindia.net/javascript/javascript-calendar.shtml

I have currently used the following sas input to create custom HTML input form for simple items.

http://support.sas.com/kb/37/050.html

Any help/input with this is highly appreciated.

Thanks

SGB


Accepted Solutions
Solution
‎08-15-2012 05:53 PM
Trusted Advisor
Posts: 1,300

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Because EG integrates IE as the browser for html there is some additional trickery needed to make this work properly:

ods _all_ close;

filename tmp temp;

ods path work.myDefault(update) sashelp.tmplmst(read) work.template(update);

proc template;

define style work.myDefault;

  parent=styles.default;

  replace Document /

   htmldoctype = "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"

   protectspecialchars = no;

end;

define tagset tagsets.jquery;

  parent=tagsets.html4;

  define event doc;

   start:

    put HTMLDOCTYPE NL;

  put "<html>" NL;

   finish:

    put "</html>" NL;

  end;

  define event doc_head;

   start:

    put "<script src=""https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js""></script>" NL;

    put "<script src=""https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js""></script>" NL;

    put "<script type=""text/javascript"">" NL;

    put " $(function(){" NL;

    put "      $(""#datepicker"").datepicker();" NL;

    put " });" NL;

    put "</script>" NL;

    put "<link rel=""stylesheet"" href=""http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css"" type=""text/css"" media=""all"" />";

   finish:

    put "" NL;

  end;

end;

run;

ods tagsets.jquery file=tmp encoding='utf-8' style=work.myDefault;

data _null_;

file print;

input;

put _infile_;

cards4;

<h1>Sample: JQuery Datepicker</h1>

This sample illustrates how to use the JQuery UI DatePicker in a stored process.

<div class="form">

<form action="http://localhost:8080/SASStoredProcess/do">

<input type="hidden" name="_program" value="/Path/To/Process">

<hr />

Choose a date: <br>

<input type="text" id="datepicker" name="myDateParm" /><br />

<hr />

<input type="Submit" value="Run Procedure" />

<input type="checkbox" name="_debug" value="log" /> Show SAS Log

</form>

</div>

;;;;

run;

ods _all_ close;

ods path reset;

View solution in original post


All Replies
Trusted Advisor
Posts: 1,300

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Instead of that javascript library, I would use JQuery, it's much simpler...

data _null_;

input @;

file _webout;

put  _infile_;

cards4;

<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">

<html>

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" media="all" />

<script>

$(function(){

      $("#datepicker").datepicker();

});

</script>

</head>

<body>

<h1>Sample: JQuery Datepicker</h1>

This sample illustrates how to use the JQuery UI DatePicker in a stored process.

<div class="form">

<form action="http://localhost:8080/SASStoredProcess/do">

<input type="hidden" name="_program" value="/Repository/Path/Process">

<hr />

Choose a date:<br />

<input type="text" id="datepicker" name="myDateParm" /><br />

<hr />

<input type="Submit" value="Run Procedure" />

</form>

</body>

</html>

;;;;

run;

Message was edited: I forgot to include some additional resources

Contributor SGB
Contributor
Posts: 41

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Hi FriedEgg:smileycool:

Thanks for taking time.

What would be the output for this code?!. Will it create a popupcalender? along with the box?!

Trusted Advisor
Posts: 1,300

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

It will create a text box that also has a datepicker popup.

jQuery UI - Datepicker Demos &amp; Documentation

Contributor SGB
Contributor
Posts: 41

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Thanks again! It created the textbox, but I dont see the popup in the Results-HTML window.

In the above link you have sent I could able to see the calender when I click on the textbox.

Am I missing something?. Do you mind taking this conversation privately?!.


Thanks a lot for your time.

SGB

Solution
‎08-15-2012 05:53 PM
Trusted Advisor
Posts: 1,300

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Because EG integrates IE as the browser for html there is some additional trickery needed to make this work properly:

ods _all_ close;

filename tmp temp;

ods path work.myDefault(update) sashelp.tmplmst(read) work.template(update);

proc template;

define style work.myDefault;

  parent=styles.default;

  replace Document /

   htmldoctype = "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"

   protectspecialchars = no;

end;

define tagset tagsets.jquery;

  parent=tagsets.html4;

  define event doc;

   start:

    put HTMLDOCTYPE NL;

  put "<html>" NL;

   finish:

    put "</html>" NL;

  end;

  define event doc_head;

   start:

    put "<script src=""https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js""></script>" NL;

    put "<script src=""https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js""></script>" NL;

    put "<script type=""text/javascript"">" NL;

    put " $(function(){" NL;

    put "      $(""#datepicker"").datepicker();" NL;

    put " });" NL;

    put "</script>" NL;

    put "<link rel=""stylesheet"" href=""http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css"" type=""text/css"" media=""all"" />";

   finish:

    put "" NL;

  end;

end;

run;

ods tagsets.jquery file=tmp encoding='utf-8' style=work.myDefault;

data _null_;

file print;

input;

put _infile_;

cards4;

<h1>Sample: JQuery Datepicker</h1>

This sample illustrates how to use the JQuery UI DatePicker in a stored process.

<div class="form">

<form action="http://localhost:8080/SASStoredProcess/do">

<input type="hidden" name="_program" value="/Path/To/Process">

<hr />

Choose a date: <br>

<input type="text" id="datepicker" name="myDateParm" /><br />

<hr />

<input type="Submit" value="Run Procedure" />

<input type="checkbox" name="_debug" value="log" /> Show SAS Log

</form>

</div>

;;;;

run;

ods _all_ close;

ods path reset;

Contributor SGB
Contributor
Posts: 41

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

wow Great FriedEgg..This worked perfectly well..

Thanks a ton for your time and input.

I highly appreciate that.

SGB

Contributor SGB
Contributor
Posts: 41

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

Hi FriedEgg

I have a question with respect to your recent suggestion.

When I run this code, I dont see anything in 'Results-SAS Report window' and 'Results HTML window'. I have another window opened mimicking the browser / streaming results.

How to make that happen for another custom HTML input form that I am workig on!


Contributor SGB
Contributor
Posts: 41

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

I understand that it is being created by the filename tmp temp; What is the purpose of creating that?!

Trusted Advisor
Posts: 1,300

Re: SAS Stored Processes - Custom HTML code - Java Script - Popup calender

That was just to test this using non-streaming html for a stored process running in EG.  I would recommend using the structure in the original posting I sent with file _webout;  Make sure the store process is not using %stpbegin/end macros and make sure the stp actually runs on the stp server and not elsewhere, like a logical workspace server...  The %stpbegin macro is why you are seeing the empty 'Results-SAS Report window', 'Results HTML window' should contain you custom form using the hacked up ods template for testing in EG without using a stp.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 1360 views
  • 6 likes
  • 2 in conversation