Re: [Dev] Get values from javascript or html into jaggery
Hi Aaquibah, You cannot use 'document.getElementById()' function in Jaggery, because 'the document' (HTML page) is in the client-side and Jaggery runs in the server-side. If you want to access a value from a HTML page, then you have to do a form submission (POST request) or a AJAX call from client-side. We can help you further if you can elaborate your use-case and code. Thanks. On Fri, Jul 10, 2015 at 1:45 PM, Aaquibah Nashry wrote: > //my code is: > where YEAR(Date__c)=*"+year+" *AND ... > > i get the following error: > > *message* *org.mozilla.javascript.EcmaError: ReferenceError: "year" is > not defined. (/ProductJaggery//PipelineGraph.jag#64)* > > Regards, > > M.R.Aaquibah Nashry > *Intern, Engineering**| **WSO2, Inc.* > Mobile : +94 773946123 > Tel : +94 112662541 > Email : nas...@wso2.com > > On Fri, Jul 10, 2015 at 1:25 PM, Chamalee De Silva > wrote: > >> Hi Nashry, >> >> You can use the variables you create in JavaScript same in Jaggery code. >> Becuase Jaggery is all about Javascript. >> >> *"As a pure Javascript server-side scripting engine, Jaggery combines all >> the strengths of Javascript with flexibility and freedom at both the >> development and deployment stages. Most JavaScript webapp development >> mechanisms restrict developers to a framework-specific structure or >> patterns, which demand an additional learning curve. By contrast, with >> Jaggery, any developers who are versed in Javascript have everything they >> need to get going."* >> >> >> On Fri, Jul 10, 2015 at 1:16 PM, Lakshani Gamage >> wrote: >> >>> Hi Aaquibah, >>> >>> Please follow the link[1]. It'll help to solve your problem. >>> >>> [1] >>> http://blog.lasindu.com/2014/05/how-to-write-wso2-jaggery-application.html >>> >>> Thanks, >>> Lakshani >>> >>> On Fri, Jul 10, 2015 at 1:09 PM, Aaquibah Nashry >>> wrote: >>> Hi, I need to get the values of javascript variables or values of html elements into jaggery code. What i am doing is, i am getting values from html elements and i need to send them inside the query in jaggery. That is, in html i have a dropdown as *Year*, i want to pass the value selected. Below is the javascript code with the jaggery code: function DrawGraph(){ var year=document.getElementById("Year").value; <% var query = "select sum(Best_Case__c) as 'Best' FROM Opp WHERE YEAR(Date__c)=*year* %> } How can i do this? Any example? Tutorials? Thanks in advance. Regards, M.R.Aaquibah Nashry *Intern, Engineering**| **WSO2, Inc.* Mobile : +94 773946123 Tel : +94 112662541 Email : nas...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >>> -- >>> Lakshani Gamage >>> >>> *Software Engineer* >>> Mobile : +94 (0) 71 5478184 <%2B94%20%280%29%20773%20451194> >>> >>> ___ >>> Dev mailing list >>> Dev@wso2.org >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Thanks & Regards, >> >> *Chamalee De Silva* >> Software Engineer >> *WS**O2* Inc. .:http://wso2.com >> lean *.* enterprise *.* middleware >> >> Office :- *+94 11 2145345 <%2B94%2011%202145345>* >> mobile :- *+94 7 <%2B94%2077%202782039>1 4315942* >> > > > ___ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Sajith Ariyarathna Software Engineer; WSO2, Inc.; http://wso2.com/ mobile: +94 77 6602284, +94 71 3951048 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Get values from javascript or html into jaggery
//my code is: where YEAR(Date__c)=*"+year+" *AND ... i get the following error: *message* *org.mozilla.javascript.EcmaError: ReferenceError: "year" is not defined. (/ProductJaggery//PipelineGraph.jag#64)* Regards, M.R.Aaquibah Nashry *Intern, Engineering**| **WSO2, Inc.* Mobile : +94 773946123 Tel : +94 112662541 Email : nas...@wso2.com On Fri, Jul 10, 2015 at 1:25 PM, Chamalee De Silva wrote: > Hi Nashry, > > You can use the variables you create in JavaScript same in Jaggery code. > Becuase Jaggery is all about Javascript. > > *"As a pure Javascript server-side scripting engine, Jaggery combines all > the strengths of Javascript with flexibility and freedom at both the > development and deployment stages. Most JavaScript webapp development > mechanisms restrict developers to a framework-specific structure or > patterns, which demand an additional learning curve. By contrast, with > Jaggery, any developers who are versed in Javascript have everything they > need to get going."* > > > On Fri, Jul 10, 2015 at 1:16 PM, Lakshani Gamage > wrote: > >> Hi Aaquibah, >> >> Please follow the link[1]. It'll help to solve your problem. >> >> [1] >> http://blog.lasindu.com/2014/05/how-to-write-wso2-jaggery-application.html >> >> Thanks, >> Lakshani >> >> On Fri, Jul 10, 2015 at 1:09 PM, Aaquibah Nashry wrote: >> >>> Hi, >>> >>> I need to get the values of javascript variables or values of html >>> elements into jaggery code. >>> >>> What i am doing is, i am getting values from html elements and i need to >>> send them inside the query in jaggery. >>> That is, >>> in html i have a dropdown as *Year*, i want to pass the value selected. >>> Below is the javascript code with the jaggery code: >>> >>> function DrawGraph(){ >>> var year=document.getElementById("Year").value; >>> >>> <% >>> var query = "select sum(Best_Case__c) as 'Best' FROM Opp WHERE >>> YEAR(Date__c)=*year* >>> %> >>> >>> } >>> >>> How can i do this? >>> Any example? Tutorials? >>> >>> Thanks in advance. >>> Regards, >>> >>> M.R.Aaquibah Nashry >>> *Intern, Engineering**| **WSO2, Inc.* >>> Mobile : +94 773946123 >>> Tel : +94 112662541 >>> Email : nas...@wso2.com >>> >>> ___ >>> Dev mailing list >>> Dev@wso2.org >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Lakshani Gamage >> >> *Software Engineer* >> Mobile : +94 (0) 71 5478184 <%2B94%20%280%29%20773%20451194> >> >> ___ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Thanks & Regards, > > *Chamalee De Silva* > Software Engineer > *WS**O2* Inc. .:http://wso2.com > lean *.* enterprise *.* middleware > > Office :- *+94 11 2145345 <%2B94%2011%202145345>* > mobile :- *+94 7 <%2B94%2077%202782039>1 4315942* > ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Get values from javascript or html into jaggery
Hi Nashry, You can use the variables you create in JavaScript same in Jaggery code. Becuase Jaggery is all about Javascript. *"As a pure Javascript server-side scripting engine, Jaggery combines all the strengths of Javascript with flexibility and freedom at both the development and deployment stages. Most JavaScript webapp development mechanisms restrict developers to a framework-specific structure or patterns, which demand an additional learning curve. By contrast, with Jaggery, any developers who are versed in Javascript have everything they need to get going."* On Fri, Jul 10, 2015 at 1:16 PM, Lakshani Gamage wrote: > Hi Aaquibah, > > Please follow the link[1]. It'll help to solve your problem. > > [1] > http://blog.lasindu.com/2014/05/how-to-write-wso2-jaggery-application.html > > Thanks, > Lakshani > > On Fri, Jul 10, 2015 at 1:09 PM, Aaquibah Nashry wrote: > >> Hi, >> >> I need to get the values of javascript variables or values of html >> elements into jaggery code. >> >> What i am doing is, i am getting values from html elements and i need to >> send them inside the query in jaggery. >> That is, >> in html i have a dropdown as *Year*, i want to pass the value selected. >> Below is the javascript code with the jaggery code: >> >> function DrawGraph(){ >> var year=document.getElementById("Year").value; >> >> <% >> var query = "select sum(Best_Case__c) as 'Best' FROM Opp WHERE >> YEAR(Date__c)=*year* >> %> >> >> } >> >> How can i do this? >> Any example? Tutorials? >> >> Thanks in advance. >> Regards, >> >> M.R.Aaquibah Nashry >> *Intern, Engineering**| **WSO2, Inc.* >> Mobile : +94 773946123 >> Tel : +94 112662541 >> Email : nas...@wso2.com >> >> ___ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Lakshani Gamage > > *Software Engineer* > Mobile : +94 (0) 71 5478184 <%2B94%20%280%29%20773%20451194> > > ___ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Thanks & Regards, *Chamalee De Silva* Software Engineer *WS**O2* Inc. .:http://wso2.com lean *.* enterprise *.* middleware Office :- *+94 11 2145345 <%2B94%2011%202145345>* mobile :- *+94 7 <%2B94%2077%202782039>1 4315942* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Get values from javascript or html into jaggery
Hi Aaquibah, Please follow the link[1]. It'll help to solve your problem. [1] http://blog.lasindu.com/2014/05/how-to-write-wso2-jaggery-application.html Thanks, Lakshani On Fri, Jul 10, 2015 at 1:09 PM, Aaquibah Nashry wrote: > Hi, > > I need to get the values of javascript variables or values of html > elements into jaggery code. > > What i am doing is, i am getting values from html elements and i need to > send them inside the query in jaggery. > That is, > in html i have a dropdown as *Year*, i want to pass the value selected. > Below is the javascript code with the jaggery code: > > function DrawGraph(){ > var year=document.getElementById("Year").value; > > <% > var query = "select sum(Best_Case__c) as 'Best' FROM Opp WHERE > YEAR(Date__c)=*year* > %> > > } > > How can i do this? > Any example? Tutorials? > > Thanks in advance. > Regards, > > M.R.Aaquibah Nashry > *Intern, Engineering**| **WSO2, Inc.* > Mobile : +94 773946123 > Tel : +94 112662541 > Email : nas...@wso2.com > > ___ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Lakshani Gamage *Software Engineer* Mobile : +94 (0) 71 5478184 <%2B94%20%280%29%20773%20451194> ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] Get values from javascript or html into jaggery
Hi, I need to get the values of javascript variables or values of html elements into jaggery code. What i am doing is, i am getting values from html elements and i need to send them inside the query in jaggery. That is, in html i have a dropdown as *Year*, i want to pass the value selected. Below is the javascript code with the jaggery code: function DrawGraph(){ var year=document.getElementById("Year").value; <% var query = "select sum(Best_Case__c) as 'Best' FROM Opp WHERE YEAR(Date__c)=*year* %> } How can i do this? Any example? Tutorials? Thanks in advance. Regards, M.R.Aaquibah Nashry *Intern, Engineering**| **WSO2, Inc.* Mobile : +94 773946123 Tel : +94 112662541 Email : nas...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev