Newb: Passing a spry variable into an onClick function?
So I have a spry table that's populating great and everything is working fine. I want to add the ability to run a simple function when a row is clicked.
The code I've written...
<tr spry:repeat="ds1" spry:hover="hover" spry:select="selected" onClick="DoNav({@name})">
Here's the function...
function DoNav(theLocation){ alert(theLocation); }
When I click the row nothing appears to happen but Firefox's error console returns an error: "Error: ThisNodesLocation is not defined"
"ThisNodesLocation" is the value of @name in this instance.
Any help would be greatly appreciated.
Thanks.
onClick="DoNav('{@name}')"
You should wrap it in strings like i did above
Similar Messages
-
How to pass a JavaScript variable into a java method
I would like to know how to pass a JavaScript variable into a java method with in a <% %> tag inside a JSP file like so:
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<script LANGUAGE="JavaScript">
myValue = someDynamicValue;
<% System.out.println(myValue)%>
</script>
</head>
<body>
</body>
</html>
obviously "System.out.println(myValue)" will not work because myValue is seen as a java variable and not a JavaScript variable.
I would like to know how to let the jsp file, that I wrote in the above code, see myValue as a JavaScript variable and not a java variable so that I can pass it to a java method.
NOTE: the java method does not have to be a println() method, it can be any method of my choice.
NOTE: someDynamicValue is a JavaScript value that can dynamically changeI don't believe you can. JSPs are really just elaborate templates that an engine such as Tomcat parses and generates an HTML page based on. That page is then displayed to the user. By the time you want to use some function in Javascript, the JSP has already been parsed and generated.
Basically, Javascript and JSPs can't talk to each other. One's server-side and the other is client-side. -
How to pass a jsp variable into javascript??
<p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<p><html>
<p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
<p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
<p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
<p>Time until next game
<p><c:forEach var="tuple" items="${tuples}">
<p><c:if test="${fn:contains(tuple, 'row ')}">
<p> <p><code>
<p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
<p> <font color="blue">
<p> <c:out value="${values[17]}" />
<p><c:set var="remainingtime" value="${values[17]}" />
<p> </font>
<p> </code>
<p></c:if>
<p></c:forEach>
<p><form name="counter"><input type="text" size="8" name="d2"></form>
<p><script>
<p>var milisec=0
<p>var seconds=eval("document.myForm.remaining").value;
<p>function display(){
<p> if (milisec<=0){
<p> milisec=9
<p> seconds-=1
<p>}
<p>if (seconds<=-1){
<p> milisec=0
<p> seconds+=1
<p> }
<br>else
<p> milisec-=1
<p> document.counter.d2.value=seconds+"."+milisec
setTimeout("display()",100)
<p>}
<p>display()
<p></script>
<p></body>
<p></html>
<p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
Message was edited by:
hamham3001
Message was edited by:
hamham3001
Message was edited by:
hamham3001
Message was edited by:
hamham3001Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
<html>
<body>
<form name=f>
<%!
String str = "A String"
%>
<script>
var avariable = <%=str%>
<script>
</form>
</body>
</html>
Let me know if you face any problem -
How to pass OSB fault variables into input payload
Hi ,
I am very new to OSB. as we know that OSB has some predefined variable structure like body,header, fault,inbound,outbound,..My requirement is that I want pass the fault variable elements(errorCode,reason,details..) to input payload elements. I want to see the faulted data in my payload elements which is generated by fault variables.
Ex:-> If any validation fault occur then my payload fault variables will display errorCode---->BEA-382525, errorMessage-->Variable targeted for validate is not XML or MFL..
Could you please help me out.I tried but i did not get the result what I expected .. Thanks in advance
Thanks,
ViswasHi Vlad,
I tried what you said in the Otherwise section.
Step 1:-->This is my xQuery code:
declare namespace ns1 = "http://www.bea.com/wli/sb/context";
declare namespace ns0 = "http://xmlns.itc.com/emf/xsd/04/2013/v1.0/loggingService";
declare namespace xf = "http://tempuri.org/GreetingService/xquery/faultToGreetingService/";
declare function xf:faultToGreetingService($fault1 as element(ns1:fault))
as element(ns0:logInfo) {
<ns0:logInfo>
<ns0:HeaderInfo>
<ns0:faultCode>{ data($fault1/ns1:errorCode) }</ns0:faultCode>
</ns0:HeaderInfo>
</ns0:logInfo>
declare variable $fault1 as element(ns1:fault) external;
xf:faultToGreetingService($fault1)
Note: My requirement is I want pass this errorCode into ns0:faultCode which is the input element for publish action (This is publish action would call the logging Service, It is one-way process)
Step2:-->I used a replace action-->XQuery Resource tab--> I browse the xQuery ..Here In the Variable Name section it is showing fault1 and what value we need to give in the Binding section.
a) If i did not provide any value it is giving the error message as "XQuery expression validation failed:XQuery error for the variable "fault1": line1,column1: {err}XP0003:invalid... "
b) If i provide $fault1 or $fault1/*:errorCode or $body in Binding section then the public action would not calling the logging service.
Can anybody provide me the answer.
Thanks,
Viswas -
How to put a jsp variable into a javascript function?
Please read the following coding. I want to pass the variable ans from jsp to the function check_answer() of javascript. ans is a string got from database. But I cannot put the variable ans into the Javascript function. Can anyone help?
<script language="Javascript">
function check_answer() {
if (testing.result.value==ans ){
window.alert("You have got 10 marks.");
</script>
<body>
<form name="testing"...>
<%
ResultSet rs = stmt.executeQuery("select * from level where...");
while(rs.next())
out.println("<tr>");
out.println("<td>" + rs.getString("question") + "</td>");
ans = rs.getString("answer");
out.println("</tr>");
out.println("<input type='text' name='result'>);
out.println("<input type='button' value='Enter' onclick='check_answer()'>");
%>The following should be able to pass ans.
<script language="Javascript">
function check_answer(ans) {
if (testing.result.value==ans ){
window.alert("You have got 10 marks.");
</script>
<body>
<form name="testing"...>
<%
ResultSet rs = stmt.executeQuery("select * from level where...");
while(rs.next())
out.println("<tr>");
out.println("<td>" + rs.getString("question") + "</td>");
ans = rs.getString("answer");
out.println("</tr>");
out.println("<input type='text' name='result'>);
out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
%>jag -
How to pass table type variable into function from SQL*PLUS ?
How to pass a table type variable from sql*plus prompt into a function ?
Thanx in advance.Krishna,
Do you mean like this?SQL> DECLARE
2 TYPE t_tbl IS TABLE OF VARCHAR2(20);
3 l_sample_tbl t_tbl;
4
5 FUNCTION print_contents ( p_tbl IN t_tbl )
6 RETURN VARCHAR2
7 IS
8 l_string VARCHAR2(1000);
9 BEGIN
10 FOR i IN 1..p_tbl.COUNT LOOP
11 IF (i = 1) THEN
12 l_string := p_tbl(i);
13 ELSE
14 l_string := l_string || ', ' || p_tbl(i);
15 END IF;
16 END LOOP;
17 RETURN (l_string);
18 END print_contents;
19
20 BEGIN
21 l_sample_tbl := t_tbl();
22 l_sample_tbl.EXTEND;
23 l_sample_tbl(1) := 'one';
24 l_sample_tbl.EXTEND;
25 l_sample_tbl(2) := 'two';
26 l_sample_tbl.EXTEND;
27 l_sample_tbl(3) := 'three';
28 l_sample_tbl.EXTEND;
29 l_sample_tbl(4) := 'four';
30 l_sample_tbl.EXTEND;
31 l_sample_tbl(5) := 'five';
32 DBMS_OUTPUT.PUT_LINE(print_contents(l_sample_tbl));
33 END;
34 /
one, two, three, four, five
PL/SQL procedure successfully completed.
SQL> HTH,
T. -
Passing Pl/Sql variables into shell variables.
I have written a file that ftp information from one pc to another in unix.
All you have to do is supply a user_name/password and machine name to which ftp program will connect to.
All connection information like user_id,password, machine name are stored in an oracle table FTP_TBL.
It has the following fields:
FTP_TBL
================
USER_ID NOT NULL VARCHAR2(100);
USR_PASSWD NOT NULL VARCHAR2(50);
TO_MACHINE NOT NULL VARCHAR2(50);
I have called a pl/sql script in unix shell.
This script selects all the connection information from FTP_TBL and populates the pl/sql variables with the
information.
Now i want the pl/sql variables like V_TO_MACHINE,V_USR_ID,V_USR_PASSWD to be passed on to unix variables
To_MACHINE, USR_ID AND USR_PASSWD.
How can i do this?
============================================================================================================
sqlplus -s <<+++ >> $LOG_FILE
$USER/$PASSWD
set serverout on SIZE 1000000
DECLARE
V_TO_MACHINE VARCHAR2(100);
V_USR_ID VARCHAR2(50);
V_USR_PASSWD VARCHAR2(50);
BEGIN
BEGIN
SELECT TO_MACHINE, USER_ID, USR_PASSWD
INTO V_TO_MACHINE,V_USR_ID,V_USR_PASSWD
FROM FTP_TBL;
EXCEPTION
when others then
dbms_output.put_line('ERROR|SQLPLUS|'||ERROR||'|'||sqlcode||'|Failed during selecting configuration information.'||sqlerrm );
END;
END;
+++
#======================== VARIABLES =====================
TO_MACHINE=$1
USR_ID=$2
USR_PASSWD=$3
#========================== MAIN ========================
ftp -vnd $TO_MACHINE << ++ 1>>$STA_LOG_FILE 2>&1
user $USR_ID $USR_PASSWD
prompt off
get $OR_DATA_DIR/ASC.STADATA $HOME_DIR/ASC.STADATA
bye
++
# testing the exit status of FTP
egrep "Transfer complete" $STA_LOG_FILE >/dev/null
if [ $? = 0 ]
then
echo >> $STA_LOG_FILE
echo "FTP Successfully Done" >> $STA_LOG_FILE
else
echo >> $STA_LOG_FILE
echo "FTP UnSuccessfull" >> $STA_LOG_FILE
exit 1
fiHere an example of how to pass variables to the shell script :
TEST@db102 SQL> select ename, job, dname from emp,dept
2 where empno = 7902
3 and emp.deptno = dept.deptno;
ENAME JOB DNAME
FORD ANALYST RESEARCH
TEST@db102 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[ora102 work db102]$ cat disp_var.sh
set `sqlplus -s test/test << EOF
set pages 0
select ename, job, dname from emp,dept
where empno = 7902
and emp.deptno = dept.deptno;
exit
EOF`
echo $1 $2 $3
[ora102 work db102]$ ./disp_var.sh
FORD ANALYST RESEARCH
[ora102 work db102]$ -
Passing a Spry XML Dataset to a function
I am very much a noob at this. How would I pass my XML dataset to a function so that the function would check a "date" field in the XML file and color the corresponding date cell in a YUI calendar? I have looked through the YUI Forums, but couldn't find any good examples. I am making a calendar of events that uses a calendar to filter the events in my XML file. I want the calendar to highlight the dates that have an event scheduled, so the users get a visual pointer to when events are scheduled. Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/xpath.js" type="text/javascript"></script>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<script src="SpryAssets/SpryDataExtensions.js" type="text/javascript"></script>
<script src="yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script>
<script src="yui/2.6.0/build/calendar/calendar-min.js" type="text/javascript"></script>
<script src="SpryAssets/SpryDOMUtils.js" language="javascript" type="text/javascript"></script>
<script type="text/javascript">
<!--
var dsMDEvents = new Spry.Data.XMLDataSet("schedule.xml", "events/event", {sortOnLoad: "date", sortOrderOnLoad: "ascending"});
var dsEvents = new Spry.Data.XMLDataSet("schedule.xml", "events/event", {sortOnLoad: "date", sortOrderOnLoad: "ascending"} );
dsEvents.setColumnType("date", "date");
dsEvents.setColumnType("@id", "number");var thisDate = new Date();
var todaysDate = mydateFormat(thisDate);
function pad(v)
return (v<10?"0"+v:v);
function mydateFormat(inDate)
var myData = inDate;
var gToday = new Date(myData);
var tToday = pad(gToday.getMonth()+1).toString() + "/" + pad(gToday.getDate()).toString() + "/" + gToday.getFullYear().toString();
return (tToday);
}//-->
</script>
<link href="yui/2.6.0/build/fonts/fonts-min.css" rel="stylesheet" type="text/css" />
<link href="yui/2.6.0/build/calendar/assets/skins/sam/calendar.css" rel="stylesheet" type="text/css" /><link href="SpryAssets/SpryMasterDetail.css" rel="stylesheet" type="text/css" />
</head><body>
<div id="Schedule">
<div id="calendarDiv"></div>
<script type="text/javascript">
// BeginWebWidget YUI_Calendar: yuicalendar1
YAHOO.namespace("calendar"); (function() {
var cn = document.body.className.toString();
if (cn.indexOf('yui-skin-sam') == -1) {
document.body.className += " yui-skin-sam";
YAHOO.calendar.init = function() {
YAHOO.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1", "CalendarDiv", {PAGES:3}); // The following event subscribers demonstrate how to handle
// YUI Calendar events, specifically when a date cell is
// selected and when it is unselected.
// See: http://developer.yahoo.com/yui/calendar/ for more
// information on the YUI Calendar's configurations and
// events.
// The YUI Calendar API cheatsheet can be found at:
// http://yuiblog.com/assets/pdf/cheatsheets/calendar.pdf
//--- begin event subscribers ---//
YAHOO.calendar.cal1.selectEvent.subscribe(selectHandler, YAHOO.calendar.cal1, true);
YAHOO.calendar.cal1.deselectEvent.subscribe(deselectHandler, YAHOO.calendar.cal1, true);
//--- end event subscribers ---//
function dateHighlightRenderer(workingDate, cell) {
var isHighlighted = false;
var date = workingDate.getMonth()+1 + "/" + workingDate.getDate() + "/" + workingDate.getFullYear();
/*if (rows["date"].search(date) != -1) {
isHighlighted = true;
if (date) {
isHighlighted = true;
if (isHighlighted) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
//YAHOO.calendar.cal1.addRenderer("11/14/2009, 11/1/2009, 11/29/2009, 11/30/2009", YAHOO.calendar.cal1.renderCellStyleHighlight1);
for (var i = 1; i <= 7; i++) {
// Attach to the Weekday, instead of individual dates/ranges, to improve performance.
YAHOO.calendar.cal1.addWeekdayRenderer(i, dateHighlightRenderer);
YAHOO.calendar.cal1.render();
var todayFilterFunc = function(dsMDEvents, row, rowNumber)
if (row["date"] >= todaysDate)
return row; // Return the row to keep it in the data set.
return null; // Return null to remove the row from the data set.
dsMDEvents.filter(todayFilterFunc);
} function selectHandler(event, data) {
// The JavaScript function subscribed to yuicalendar1. It is called when
// a date cell is selected.
// alert(event) will show an event type of "Select".
// alert(data) will show the selected date as [year, month, date].
var formattedDate = pad(data[0][0][1]) + "/" + pad(data[0][0][2]) + "/" + data[0][0][0];
var dateFilterFunc = function(dsMDEvents, row, rowNumber)
if (row["date"].search(formattedDate) != -1)
return row; // Return the row to keep it in the data set.
return null; // Return null to remove the row from the data set.
dsMDEvents.filter(dateFilterFunc); // Filter the rows in the data set.
}; function deselectHandler(event, data) {
// The JavaScript function subscribed to yuicalendar1. It is called when
// a selected date cell is unselected.
}; // Create the YUI Calendar when the HTML document is usable.
YAHOO.util.Event.onDOMReady(YAHOO.calendar.init);
// EndWebWidget YUI_Calendar: yuicalendar1
</script>
<div class="MasterDetail">
<div spry:region="dsMDEvents" class="MasterContainer">
<div class="MasterColumn" spry:repeat="dsMDEvents" spry:setrow="dsMDEvents" spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{date}<br />
{name}<br />
{starttime} - {endtime}</div>
</div>
<div spry:detailregion="dsMDEvents" class="DetailContainer">
<h2 class="DetailColumn">{name}</h2>
<p class="DetailColumn"><strong>Date:</strong> {date}<br />
<strong>Time:</strong> {starttime} - {endtime}</p>
<p class="DetailColumn"><strong>Where:</strong> {location}<br />
<strong>Type:</strong> {type}</p>
<p class="DetailColumn"><strong>Contact:</strong> {contact}</p>
</div>
<br style="clear:both" />
</div>
</div>
</body>
</html>
and here is a snipet of my xml file:
<?xml version="1.0" encoding="utf-8"?>
<events>
<event id="1">
<name>Dreamweaver CS4 Intermediate</name>
<date>10/15/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 1</location>
<type>Training</type>
<contact>Contact 1</contact>
</event>
<event id="2">
<name>InDesign CS4 Advanced</name>
<date>11/14/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Training</type>
<contact>Contact 1</contact>
</event>
<event id="3">
<name>Flex CS4 Data Services</name>
<date>10/15/2009</date>
<starttime>1:00 pm</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Meeting</type>
<contact>Contact 2</contact>
</event>
<event id="4">
<name>Another Dreamweaver CS4 Intermediate</name>
<date>11/30/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 1</location>
<type>Training</type>
<contact>Contact 1</contact>
</event>
<event id="5">
<name>Another InDesign CS4 Advanced</name>
<date>11/29/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Training</type>
<contact>Contact 3</contact>
</event>
<event id="6">
<name>Another Flex CS4 Data Services</name>
<date>11/01/2009</date>
<starttime>1:00 pm</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Meeting</type>
<contact>Contact 2</contact>
</event>
<event id="7">
<name>More Training</name>
<date>11/02/2009</date>
<starttime>8:00 am</starttime>
<endtime>10:00 am</endtime>
<location>Room 3</location>
<type>Training</type>
<contact>Contact 4</contact>
</event>
<event id="8">
<name>Another Training</name>
<date>10/25/2009</date>
<starttime>9:00 am</starttime>
<endtime>11:00 am</endtime>
<location>Room 3</location>
<type>Training</type>
<contact>Contact 4</contact>
</event>
<event id="9">
<name>Some More Training</name>
<date>12/02/2009</date>
<starttime>1:00 pm</starttime>
<endtime>3:00 pm</endtime>
<location>Room 3</location>
<type>Training</type>
<contact>Contact 4</contact>
</event>
</events>
The function "dateHighlightRenderer" is where I am running into the problem. How do I code this so that "dateHighlightRenderer" can read the "date" field in my XML file?I have tried the getData() function for this. However, I am not sure if I am using it right:
var d = dsMDEvents.getData();
for (var i = 0; i < d.length(); i++) {
var day = d[i]["date"];
YAHOO.calendar.cal1.addRenderer(day, dateHighlightRenderer);
When I run this for loop, my calendar will not appear on the page. Any suggestions? -
Passing variable into pdf document
I have created a pdf document that I want to share with my marketing team. However, in the document I want the url to be dynamic and show that individual's url. For example, if my domain is www.xyz123abc.com In the pdf, I want to setup the url in the document as www.xyz123abc.com/REPSITE. Then when the pdf is opened from each individual's site, we will pass the REPSITE variable into the pdf document. If my marketing page is www.xyz123abc.com/jim. When someone visits my website and opens the pdf, they will see www.xyz123abc.com/jim. When my partner Bob's site is visited, the pdf will display www.xyz123abc.com/bob.
So how can I dynamically pass variables from a website into the pdf?Don't know if there is a better way, but you could use the 'identity Object'. Just make sure that the Identity is set in the application preferences for each employee
var userName = identity.name
Edit: Sorry, after rereading your post, I don't think this is what you are asking for. Perhaps the 'HostContainer Object' wll allow you to do what you want? -
Passing array variables into functions (and why I'm hopeless at arrays)
OK, I have spent a day on this now and have done some fairly
extensive searching online. The problem is - I am hopeless with
arrays (and probably just actionscript generally for that matter)
I want to create an array of buttons, so I set up an array of
actions, step through each item and then try to pass that array
action into an onclick button for an attached button
The problem I have is that the onclick function ALWAYS
returns the last item in the array.
Help!
Code below:
----------------------------------------------------------------the reason for this, is that once the for loop executes, the
'last' value is the only one remaining. what one needs to do here
is 'store' the string in a newly created property on each button,
like this: -
Pass variable into xMII applet???
Is it possible to pass a javascript variable into the xMII applet?
I guess what I asking is could I place a variable that I created in the head of the html file and then call for it in the applet.
The variable is called in the Applet name below.
For Example:
<html>
<head>
<script>
var TEST = alert("")
</script>
</head>
<body>
<tr>
<td>
<applet name="TEST" codebase="/Illuminator/Classes" code="iGrid" archive="illum8.zip" width="775" height="350" mayscript>
<param name="DisplayTemplate" value="/Production/gridQA_Moistures">
<param name="QueryTemplate" value="/Production/qryQA_Moistures">
<param name="UpdateEvent" value="Grid_Updated">
<param name="Param.1" value="%">
<param name="Param.2" value="%">
<param name="Param.3" value="%">
<param name="Param.4" value="%">
</applet>
</td>
</tr>
</body>
</html> -
Pass in another variable thru onFolioData()
This is my first time dealing with Adobe DPS and I am trying to pass another variable into the onFolioData function.
Right now my code looks like so:
var init_dps_api = function(productIDs, saleNumbers) {
var onFolioData = function (data) {
var len = data.length;
// The library returns an array of folio descriptor objects. Put them into a hash indexed by something more convenient (ie productId)
for (var i = 0; i < len; i++) {
folioDataHash[data[i].productId,data[i].saleNumber] = data[i];
var folio;
for (var j=0; j<productIDs.length; j++){
folio = folioDataHash[productIDs[j],saleNumbers[j]];
if (folio) {
//adobe.dps.store.getPreviewImage(productIDs[j], true, 768, 1024, onPreviewImage2(productIDs[j]));
adobe.dps.store.getPreviewImage(productIDs[j], true, 768, 1024, onPreviewImage(productIDs[j],saleNumbers[j]));
else {
//console("The productId you have defined for purchase/download does not exist within your Fulfillment account");
var onPreviewImage = function(productID,saleNumber) {
var s2= "";
var folio2 = folioDataHash[productID,saleNumber];
In the above code you can see that I want to pass in the saleNumber, but it is breaking the page. Is there a way to do this? Can someone from the Adobe team please assist?
Reason for this is that from our jsp pages, we need to pass salenumbers for our Site Catalyst tracking, so I am grabbing the salenumber from the jsp page and passing it via the javascript api to trigger an Omniture function.
Thank you for your time and patience.
B
Message was edited by: BC_SothebysIn the main jsp file, it is calling multiple publication ids from the cms. So let's say that on the page, there are 5 buckets. In each bucket, there are 5 publication ids. Each of the publication ids are being pushed into a publicationIDs array.
<script>
publicationIDs.push('<%=publicationId%>');
</script>
This array then gets called in the api
var init_dps_api = function(productIDs) {
var folioDataHash = {};
var onFolioData = function (data) {
var len = data.length;
for (var i = 0; i < len; i++) {
folioDataHash[data[i].productId] = data[i];
var folio;
for (var j=0; j<productIDs.length; j++){
folio = folioDataHash[productIDs[j]];
if (folio) {
adobe.dps.store.getPreviewImage(productIDs[j], true, 768, 1024, onPreviewImage(productIDs[j]));
else {
console("The productId you have defined for purchase/download does not exist within your Fulfillment account");
var onPreviewImage = function(productID) {
var s2= "";
var node2 = "";
var folio2 = folioDataHash[productID];
if (!folio2) return; // un-known folio...nothing to show.
if(globalTab == 'featured') {
node2 = document.getElementById(productID + "_publicationId_Holder_fc");
if(isLoggedIn) {
s2 += "<div class='buyButton' id='" + productID + "'>";
if (folio2.state=='200') {
s2 +="Download";
} else {
s2 += "View";
s2 += "</div>";
if (node2) {
node2.innerHTML = s2;
node2.onclick=function(){
buy(productID);
} else {
s2 += "<div class='buyButtonGreyed' id='" + productID + "'>";
s2 += "Register to Download";
s2 += "</div>";
if (node2) {
node2.innerHTML = s2;
node2.onclick=function(){
showMsgBox1();
if(globalTab == 'view-all') {
node2 = document.getElementById(productID + "_publicationId_Holder_va");
if(isLoggedIn) {
s2 += "<div class='buyButton' id='" + productID + "'>";
if (folio2.state=='200') {
s2 +="Download";
} else {
s2 += "View";
s2 += "</div>";
if (node2) {
node2.innerHTML = s2;
node2.onclick=function(){
buy(productID);
} else {
s2 += "<div class='buyButtonGreyed' id='" + productID + "'>";
s2 += "Register to Download";
s2 += "</div>";
if (node2) {
node2.innerHTML = s2;
node2.onclick=function(){
showMsgBox();
var onLibraryUpdate = function () {
adobe.dps.store.getFolioData(onFolioData);
// Unregister for library updates
unregisterUpdateLibraryHandler(); //commented out by Y.J.
var registerUpdateLibraryHandler = function ()
if (window.adobedpscontextloaded)
// call into the updateLibrary API
adobe.dps.store.registerLibraryUpdateCompleteHandler(onLibraryUpdate);
adobe.dps.store.updateLibrary(); //this needs to be here, otherwise, no button shows up
else {
//console("Failed to find Javascript API");
var unregisterUpdateLibraryHandler = function ()
if (window.adobedpscontextloaded)
// call into the updateLibrary API
adobe.dps.store.unregisterLibraryUpdateCompleteHandler(onLibraryUpdate);
registerUpdateLibraryHandler();
var buy = function(productID) {
var folio = folioDataHash[productID];
if (folio==null) return;
if (folio.state=='100') {
adobe.dps.store.buyFolio(productID);
}else {
adobe.dps.store.viewFolio(productID);
//showMsgBox brings up message box and black cover when user is not logged in
function showMsgBox() {
var overlay = $('#black-cover');
var wrapper = $('#warning-mmsg');
overlay.css({'display':'block'});
wrapper.css({'display':'block'});
//showMsgBox brings up message box and black cover when user is not logged in
function showMsgBox1() {
var overlay = $('#black-covers');
var wrapper = $('#warning-msgs');
overlay.css({'display':'block'});
wrapper.css({'display':'block'});
var consoleElement = document.getElementById("console");
var console = function(s) {
if (consoleElement) consoleElement.innerHTML += s + "<br/>";
} //END: init_dps_api function
This whole script works and in the storefront, all of the 5 buttons appear with the correct publication id in there buckets.
But now I want to be able to pass another variable, in this case saleNumbers, where I would do a second push:
<script>
publicationIDs.push('<%=publicationId%>');
saleNumbers.push('<//%=saleNumber%>'); // second push
</script>
and pass that into the init_dps_api function like so:
var init_dps_api = function(productIDs, saleNumbers) {
What I've done only printed the sale number for the first bucket, but I need it to print 5 different sale numbers for their respective buckets.
Thanks for your time and patience. -
How to pass spry {} variables to PHP query sentence?
I am trying to integrate AJAX poll system to a spry data set.
My goal is to dynamically generate a poll fom associated with the id no. of each data item.
So, I need to pass a spry xml variable covered by { } to a PHP query sentence.
How? Is there any existing Spry poll solution? Thanks.The following sentence has been inserted into my code, but it doesn't work:
<span spry:if="'ds_RowCount' == '0'">No Data to Display</span>
====
<div spry:region="ds1" class="SpotlightAndStacked">
<div spry:repeat="ds1" class="SpotlightAndStackedRow">
<div class="SpotlightContainer">
<div class="SpotlightColumn"> Type:{type}</div>
<div class="SpotlightColumn"> Title:{title}</div>
<div class="SpotlightColumn"> Username:{username}</div>
</div>
<div class="StackedContainer">
<div class="StackedColumn"> <img src="upPhoto/{image}" width="144" height="144"/></div>
</div>
<br style="clear:both; line-height: 0px" />
</div>
<span spry:if="'ds_RowCount' == '0'">No Data to Display</span>
</div>
==== -
Problem with passing variable into subroutine
Applescript newbie stumped again...
for some reason when call the subroutine below from my code, I get an error message on the bolded variable.
Error is:
Can't make "test" into type integer.
I am calling the subroutine like this:
createFolder(folderCreationPath, appFolderName)
And am passing in two variables that I have concatenated folder name & path name.
on createFolder(folderLocation, folderName)
tell application "Finder"
if (the folder folderName of folderLocation exists) then
display dialog folderName & " already exists."
else
make new folder at folderLocation with properties {name:folderName}
end if
end tell
end createFolder
When I display the variables inside the subroutine, both appear to be strings.
Any help would be appreciated.
Thank you.If I knew how to upload a file to the forum I would do so...
Copy & paste into script editor would reformat.
Here's the full script:
---SubRoutines------------------------------------------------------------------ ------------------------------------------------------------------
on createFolder(folderLocation, folderName)
display dialog "FolderName: " & folderName & "
Folder Location: " & folderLocation & "
" & folderLocation & folderName
tell application "Finder"
if (the folder folderName of folder folderLocation exists) then
display dialog folderName & " already exists."
else
make new folder at (folderLocation as alias) with properties {name:folderName}
end if
end tell
end createFolder
---Main Code--------------------------------------------------------------------------- ------------------------------------------------------------
set projectName to "Project " & the text returned of (display dialog "What is the name of your Project?" default answer "")
set projectLocation to choose folder
---create root project folder
createFolder(projectLocation, projectName)
---create subFolders
--List of Folder names:
set FolderMediaType to {"Project", "Media & Imports", "Exports"}
set projectApplication to {"FCP", "Soundtrack", "LiveType", "Motion", "DVD Studio Pro", "Web Videos"}
set projectLocation to projectLocation & projectName --Set's project location to include project folder
repeat with iProjectApplication from 1 to count (projectApplication)
set folderCreationPath to ((projectLocation as string) & ":") --set's folderCreation to include project folder
set appFolderName to ((iProjectApplication as string) & "-" & (item iProjectApplication of projectApplication))
createFolder(folderCreationPath, appFolderName)
set folderCreationPath to projectLocation & ":" & appFolderName & ":"
repeat with iFolderMediaType from 1 to count (FolderMediaType)
set mediaFolderName to iFolderMediaType & "-" & (item iFolderMediaType of FolderMediaType)
createFolder(folderCreationPath, mediaFolderName)
end repeat
end repeat -
Passing a selected spry value into a function
Should be relatively simple but i keep banging my head against the wall on this one.
I have a Master Region that when clicked updates the detailregion below. For the 'View All' text below, is there a way to pass the current selected {name} value from the Master Region into a onlick function event for the static text 'view all'?
<div id="current" class="currentcat" spry:detailregion="dsMainDept" spry:selected="{dsMainDept::name}">{name}</div>
<div class="viewall" spry:detailregion="dsMainDept" onclick="FilterByDept('{name}')">view all</div>
In this case, first div output {name} would change to match MasterRegion selected {name}. *The {name} is a selectable filter in the MasterRegion.* The 2nd div function would hold the currently selected {name} and when clicked, run the function that filters content based on that {name}.
Can i target the 1st div id to look for this? or should use a RegionObserver? or change something in the FilterByDept function? I'm a little lost as to what best practice would be. Let me know if more code is needed.
Thanks!instead of making your spry:select dynamic i suggest you use a static value instead something like
spry:selected="selected";
This will add the selected class to that clicked node. Now that you know what className it has, you can use SpryDOMUtls.js's CSS selector to get the right node from your list.
For example:
alert(Spry.$$('.selected')[0].innerHTML);
hopes this helps
Maybe you are looking for
-
I am trying to install the new version of Adobe Player on my Mac. I download it but can't install it. When I go to install it I get a security screen with my user ID and it asks for my password. I have reset my password but still can't get it to be a
-
T60 display problem - boot in low resolution pink/blue shade
I have a T60 2623D7U that has a screen resolution of 1400x1050. The problem I am having is that when I start the laptop it starts up with a really low resolution, probably 640x480, and the colour of the screen sometimes has a pink or blue shade. Some
-
Creative Cloud will only launch in SafeBoot. Why?
Creative Cloud crashes when I try to launch. The icon will flash once in the menu bar and then disappear. I'm running Mac OS X 10.10.3. I've tried everything I could find in the forums and elsewhere through google searches. The only way Creative Clou
-
Hi, I can't seem to find iPhoto anywhere on my computer. I'm not technical enough to find missing files from utilities and pacifist as someone suggested. Is it possible to download iPhotos 09. I can only find an upgrade to iLife '11 and I'm confused
-
Icloud deleted 2nd phone contacts and apps
I connected to iCloud when upgrading my iPhone 4 to v5 s/w. I also upgraded my wife's iPhone 3 to v5 s/w. She uses the same iTunes account to download apps, songs. All her stuff was backed up to iTunes during the upgrade. I went ahead and connected h