I am creating a basic report wherein I could pass the domain model passed by the controller to the view and use that instance as a parameter for the report.
Here the part of the <g:jasperReport> in the view[.gsp]
Note: ${user} is an instance of User inside the domain classes having those string properties: lastName, firstName, middleName
<g:jasperReport
jasper="reportByUser"
format="pdf, html">
<input type="hidden" name="u_lastName" value="${user.lastName}" />
<input type="hidden" name="u_firstName" value="${user.firstName}" />
<input type="hidden" name="u_middleName" value="${user.middleName}" />
</g:jasperReport>
Here the part of the xml code inside the reportByUser.jrxml
<parameter name="user_lastName" class="java.lang.String" />
<parameter name="user_firstName" class="java.lang.String" />
<parameter name="user_middleName" class="java.lang.String" />
The problem is when I run the report on the grails, either format return a blank page.
In:
<g:jasperReport
jasper="reportByUser"
format="pdf, html">
<input type="hidden" name="u_lastName" value="${user.lastName}" />
<input type="hidden" name="u_firstName" value="${user.firstName}" />
<input type="hidden" name="u_middleName" value="${user.middleName}" />
</g:jasperReport>
You are passing: name="u_lastName"
But in the jasper file is specting: name="user_lastName"
Check it...
Related
thank you for your support.
I created a form with select options. The fields are filled with arrays provided with the settings variable.
The field in __trustedProperties quoted with the "-sign. This results in "{" as hash.
[__trustedProperties]" value="{"newRfichip":{"id":1,"status":1,"location":1,"personid":1}}2ec7e718db7f0844040e31baaa69a8452a650302" />
Normaly there should be & quot; instead the "-sign.
[__trustedProperties]" value="{& quot;newRfichip& quot;:{& quot;id& quot;:1,& quot;status& quot;:1,& quot;location& quot;:1,& quot;personid& quot;:1}}2ec7e718db7f0844040e31baaa69a8452a650302" />
I get always an exception 'The HMAC of the form could not be validated.'
I'm grateful for every hint, how i can solve this problem
FormFields.html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<label for="id">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.id" />
</label><br />
<f:form.textfield property="id" id="id" /><br />
<br\>
<f:debug>{_all}</f:debug>
<f:debug>{__trustedProperties}</f:debug>
<br\>
<label for="status">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.status" />
</label><br />
<f:form.select property="status" id="status"
options="{settings.stati}"
value="4"
optionValueField="status"
optionLabelField="status" />
<br />
<label for="location">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.location" />
</label><br />
<f:form.select property="location" id="location"
options="{settings.location}"
value="4"
optionValueField="location"
optionLabelField="location" />
<br />
<label for="personid">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.personid" />
</label><br />
<f:form.select property="personid" id="personid"
options="{settings.personid}"
optionValueField="personid"
optionLabelField="personid" />
<br />
</html>
I have the following hardcoded form in a view:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="mymail#mymail.com" />
<input type="hidden" name="item_name" value="Attack Announcer" />
<input type="hidden" name="item_number" value="2ca168a959bb48e28a2ddb4b4640c568" />
<input type="hidden" name="amount" value="0.01" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value="?????" />
<input type="hidden" name="cancel_return" value="?????" />
<input type="hidden" name="notify_url" value="??????" />
<input type="hidden" name="no_note" value="1" />
<input type="image" name="submit"
src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"
alt="PayPal — The safer, easier way to pay online." />
<img src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif"
width="1" height="1" alt="" />
</form>
How can I take the response message after the transaction is completed (on localhost)?
For example if I have some action like:
[HttpPost]
public ActionResult PaypalConfirmation(???????????)
{
// ........................
return View();
}
you have to tell it the success url and fail url, that on success transaction go the this url and on failed transaction go to this url, you have to pass the url via hidden fields of return and cancel_return:
URL where paypal will redirect if transaction successfull:
<input type="hidden" name="return" value="#Url.Action("ActionName","ControllerName")" />
URL where paypal will redirect if transaction not Successful:
<input type="hidden" name="cancel_return" value="#Url.Action("ActionName","ControllerName")" />
Also refer this Question (Asp.net Paypal Return Url Requirement)
So, I have created a simple CRUD app using groovy on grails and I want to use jasper reporting plugin to get some simple reports on the database. I have set up a simple G:select to pick from a drop down list, and hitting the PDF icon I am bringing back a blank page. gsp is below
<div id="page-body" role="main">
<p>Please select one of the following options</p>
<div>
<g:select optionKey="id"
optionValue="artist"
name="artist"
id="MusicCatalogue"
value="${artist}"
from="${multicatalogue.MusicCatalogue.list()}">
</g:select>
</div>
<div> <g:jasperReport jasper="report1" format="PDF" name="Music Catalogue" />
<input type="hidden" name="artist" value="${artist}" />
</div>
</div>
and then the jrxml looks like the below
<parameter name="artist" isForPrompting="true" class="java.lang.String">
<defaultValueExpression><![CDATA["<parameter error>"]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[SELECT *
FROM
MusicCatalogue where ARTIST = $P{artist}]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="ALBUM" class="java.lang.String"/>
<field name="ARTIST" class="java.lang.String"/>
<field name="TRACK" class="java.lang.String"/>
<group name="ARTIST">
ideas????
Try replace
<g:jasperReport jasper="report1" format="PDF" name="Music Catalogue" />
<input type="hidden" name="artist" value="${artist}" />
With
<g:jasperReport jasper="report1" format="PDF" name="Music Catalogue">
<input type="hidden" name="artist" value="${artist}" />
</g:jasperReport>
Also, make sure that ${artist} returns a string value, else the report will use the defaultValue of artist parameter that might ruin your query.
I create textboxes dynamically with jquery. What i wonder how can i send those values into my action now with my viewmodel, kinda like this but instead of the httpPostedFileBase i want pass the values of the textboxes, I did name them like name="dTextboxes". Thanks for help im kinda stuck on this
public ActionResult Index(NewsViewModel viewModel, IEnumerable<HttpPostedFileBase> files)
You could use IEnumerable<bool> dTextboxes as action argument.
public ActionResult Index(IEnumerable<bool> dTextboxes)
assuming that in your form you have:
<input name="dTextboxes[0]" type="checkbox" value="true" />
<input name="dTextboxes[0]" type="hidden" value="false" />
<input name="dTextboxes[1]" type="checkbox" value="true" />
<input name="dTextboxes[1]" type="hidden" value="false" />
<input name="dTextboxes[2]" type="checkbox" value="true" />
<input name="dTextboxes[2]" type="hidden" value="false" />
...
I ended up doing this
public ActionResult Create(WorkViewModel viewModel, IEnumerable<string> dTextboxes)
and my dynamically textboxes looks like this
<input type="text" name="dTextboxes" />
<input type="text" name="dTextboxes" />
<input type="text" name="dTextboxes" />
and of cause in the action i do a foreach and check if string is not null after that do what i want with the string value of the textbox.
I need to gather a list of items associated with another item from my user in a ASP.NET MVC project. I would like to have a controller action like bellow.
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(int x, int y, IEnumerable<int> zKeys)
{
//Do stuff here
}
How can I setup my form to pass data in this way? If data of this particular form can't be provided, what's the next best way to pass this type of information in ASP.NET MVC?
Scott Hanselman has an excellent article on how to do this here:
ASP.NET Wire Format for Model Binding to Arrays, Lists, Collections, Dictionaries
http://www.hanselman.com/blog/...BindingToArraysListsCollectionsDictionaries.aspx
<form action="/url" method="post">
<input name="x" type="text" value="1" />
<input name="y" type="text" value="1" />
<div>
<input name="zKeys" value="1" />
<input name="zKeys" value="2" />
<input name="zKeys" value="3" />
<input name="zKeys" value="4" />
<input name="zKeys" value="5" />
<input name="zKeys" value="6" />
<input name="zKeys" value="7" />
</div>