Skip to content

Commit 43f05f7

Browse files
committed
FORMS-822:adding a success message on the detail page of a formResponse when submitting the form
1 parent f001c55 commit 43f05f7

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

src/java/fr/paris/lutece/plugins/forms/resources/forms_messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ xpage.response.error.inactive=Unavailable form response
896896
xpage.response.error.notfound=Form response not found
897897
xpage.response.pagetitle=Form response
898898
xpage.response.pathlabel=Form response
899+
xpage.response.action.success=Response created
899900

900901
message.mandatory.entry=This field is mandatory.
901902
message.errorUniqueField=This field already exists, please type another one.

src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fr.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,7 @@ xpage.response.error.inactive=R\u00e9ponse indisponible
899899
xpage.response.error.notfound=R\u00e9ponse non trouv\u00e9e
900900
xpage.response.pagetitle=R\u00e9ponse au formulaire
901901
xpage.response.pathlabel=R\u00e9ponse au formulaire
902+
xpage.response.action.success=R\u00e9ponse cr\u00e9\u00e9e
902903

903904
message.mandatory.entry=Ce champ est obligatoire.
904905
message.errorUniqueField=Ce champ existe d\u00e9jà, veuillez en saisir un autre.

src/java/fr/paris/lutece/plugins/forms/util/FormsConstants.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public final class FormsConstants
104104
public static final String PARAMETER_OCR_DOCUMENT = "ocr_document";
105105
public static final String PARAMETER_TYPE_DOCUMENT_KEY = "type_document_key";
106106
public static final String PARAMETER_ID_MAPPING = "id_mapping";
107-
108107
public static final String PARAMETER_TARGET_VIEW = "view";
109108
public static final String COMPOSITE_STEP_TYPE = "step";
110109
public static final String COMPOSITE_GROUP_TYPE = "group";
@@ -132,6 +131,8 @@ public final class FormsConstants
132131
public static final String PARAMETER_REF_LIST_VALUE = "refListValue";
133132
public static final String PARAMETER_REF_LIST_FIELD = "refListField";
134133
public static final String PARAMETER_REF_LIST_MAPPING = "refListMapping";
134+
public static final String PARAMETER_ACTION_SUCCESS = "action_success";
135+
135136

136137
public static final String PARAMETER_ACTION_GO_TO_STEP = "action_doGoToStep";
137138
public static final String PARAMETER_INFO_KEY = "info_key";
@@ -213,6 +214,7 @@ public final class FormsConstants
213214
public static final String SEPARATOR_SEMICOLON = ";";
214215
public static final String END_OF_LINE = "\n";
215216

217+
216218
/**
217219
* Default private constructor. Do not call
218220
*/

src/java/fr/paris/lutece/plugins/forms/web/FormResponseXPage.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public class FormResponseXPage extends MVCApplication
9191
protected static final String MESSAGE_FORM_RESPONSE_PATHLABEL = "forms.xpage.response.pathlabel";
9292
private static final String MESSAGE_ACTION_ERROR = "forms.xpage.response.action.error";
9393
private static final String MESSAGE_ERROR_TOKEN = "Invalid security token";
94+
private static final String MESSAGE_ACTION_SUCCESS = "forms.xpage.response.action.success";
95+
9496

9597
// Views
9698
public static final String VIEW_FORM_RESPONSE = "formResponseView";
@@ -119,12 +121,15 @@ public XPage getFormResponseView( HttpServletRequest request ) throws SiteMessag
119121
FormResponse formResponse = findFormResponseFrom( request );
120122

121123
Collection<Action> actionsList = getActionsForUser( request, formResponse );
122-
124+
if("true".equals(request.getParameter(FormsConstants.PARAMETER_ACTION_SUCCESS)))
125+
{
126+
addInfo( MESSAGE_ACTION_SUCCESS,getLocale(request) );
127+
}
123128
Map<String, Object> model = getModel( );
124129
model.put( FormsConstants.MARK_FORM_RESPONSE, formResponse );
125130
model.put( MARK_WORKFLOW_ACTION_LIST, actionsList );
126131
model.put( SecurityTokenService.MARK_TOKEN, SecurityTokenService.getInstance( ).getToken( request, ACTION_PROCESS_ACTION ) );
127-
132+
128133
XPage xPage = getXPage( TEMPLATE_VIEW_FORM_RESPONSE, getLocale( request ), model );
129134
xPage.setTitle( I18nService.getLocalizedString( MESSAGE_FORM_RESPONSE_PAGETITLE, locale ) );
130135
xPage.setPathLabel( I18nService.getLocalizedString( MESSAGE_FORM_RESPONSE_PATHLABEL, locale ) );

src/java/fr/paris/lutece/plugins/forms/web/FormXPage.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ private String getBackUrl( Form form, boolean bIsEndMessageDisplayed, int nIdFor
910910
url.addParameter( MVCUtils.PARAMETER_PAGE, FormResponseXPage.XPAGE_NAME );
911911
url.addParameter( MVCUtils.PARAMETER_VIEW, FormResponseXPage.VIEW_FORM_RESPONSE );
912912
url.addParameter( FormsConstants.PARAMETER_ID_RESPONSE, nIdFormResponse );
913+
url.addParameter( FormsConstants.PARAMETER_ACTION_SUCCESS, "true" );
914+
913915
}
914916
else
915917
if ( bIsEndMessageDisplayed )

webapp/WEB-INF/templates/skin/plugins/forms/view_form_response.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<@messages errors=errors warnings=warnings infos=infos />
12
<div class="panel panel-default">
23
<div class="panel-heading">
34
<h3 class="panel-title">${formResponse.id}</h3>

0 commit comments

Comments
 (0)