Changes for page Get in Touch About Your XWiki Project
Last modified by Alex Cotiugă on 2026/05/04 06:15
From version 13.158
edited by Alex Cotiugă
on 2026/05/02 09:06
on 2026/05/02 09:06
Change comment:
There is no comment for this version
To version 13.67
edited by Alex Cotiugă
on 2026/05/02 08:02
on 2026/05/02 08:02
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,25 +23,3 @@ 1 -{{velocity wiki="false"}} 2 -#if ($xcontext.action == 'get') 3 - #set ($message = '') 4 - #set ($now = $datetool.get('yyyyMMddHHmm')) 5 - #set ($random = $mathtool.random(100000, 999999)) 6 - #set ($uniqueName = "ContactRequest-${now}-${random}") 7 - #set ($contactFormEntryDoc = $xwiki.getDocument('ContactRequests.' + $uniqueName)) 8 - #set ($statusCode = 200) 9 - #set ($message = "$contactFormEntryDoc") 10 - 11 - #foreach ($parameterName in $request.parameterNames) 12 - #set ($message = "$message $parameterName") 13 - #end 14 - 15 - ##set ($statusCode = 400) 16 - ##set ($message = 'error') 17 - 18 - #set ($discard = $response.setStatus($statusCode)) 19 - #jsonResponse({'message': $message}) 20 -#end 21 -{{/velocity}} 22 - 23 23 {{velocity}} 24 24 #set ($discard = $xwiki.ssx.use('contact.WebHome')) 25 25 #set ($xobject = $doc.getObject('Agnease.Code.ContactForm.ContactFormClass')) ... ... @@ -61,24 +61,8 @@ 61 61 </dl> 62 62 <p>Your information will only be used to respond to this request.</p> 63 63 ##<p>Your information will only be used to respond to this request. See the Privacy Policy for details.</p> 64 - <input id="contactSubmit" type="submit" class="btn btn-primary" value="Send my request"> 42 + <input id="contactSubmit" type="submit" class="btn btn-primary" value="Send my request" disabled="disabled"> 65 65 </form> 66 - {{/html}} 67 - {{html clean="false" wiki="true"}} 68 - <div class="reviewNotifications"> 69 - <div class="hidden reviewNotificationSuccess"> 70 - 71 - {{success}}reviewNotification{{/success}} 72 - 73 - </div> 74 - <div class="hidden reviewNotificationError"> 75 - 76 - {{error}}reviewNotification{{/error}} 77 - 78 - </div> 79 - </div> 80 - {{/html}} 81 - {{html clean="false"}} 82 82 </div> 83 83 <div class="col-xs-5"> 84 84 <div class="widget"> ... ... @@ -100,6 +100,18 @@ 100 100 <li>If useful, we schedule a short call to discuss scope, timeline, and estimated effort.</li> 101 101 </ol> 102 102 </div> 65 + <div class="reviewNotifications"> 66 + <div class="hidden reviewNotificationSuccess"> 67 + 68 + {{success}}reviewNotification{{/success}} 69 + 70 + </div> 71 + <div class="hidden reviewNotificationError"> 72 + 73 + {{error}}reviewNotification{{/error}} 74 + 75 + </div> 76 + </div> 103 103 </div> 104 104 </div> 105 105 {{/html}}
- XWiki.JavaScriptExtension[0]
-
- code
-
... ... @@ -1,15 +1,25 @@ 1 1 require(['jquery'], function ($) { 2 - var serviceURL = new XWiki.Document('WebHome', 'cont act').getURL('get');3 - var form = $('# contactForm');4 - var submitButton = $('# contactSubmit');2 + var serviceURL = new XWiki.Document('WebHome', 'content').getURL('get', 'xpage=plain'); 3 + var form = $('#agneaseContactForm'); 4 + var submitButton = $('#agneaseContactSubmit'); 5 5 6 6 var successBox = $('.reviewNotificationSuccess'); 7 7 var errorBox = $('.reviewNotificationError'); 8 8 9 + function getFormData() { 10 + var data = {}; 11 + 12 + $.each(form.serializeArray(), function (_, field) { 13 + data[field.name] = field.value; 14 + }); 15 + 16 + return data; 17 + } 18 + 9 9 form.on('submit', function (event) { 10 10 event.preventDefault(); 11 11 12 - var data = $.param(form.serializeArray());22 + var data = getFormData(); 13 13 14 14 submitButton.prop('disabled', true); 15 15 ... ... @@ -28,12 +28,11 @@ 28 28 form[0].reset(); 29 29 }).fail(function (xhr) { 30 30 var errorBoxContent = errorBox.find('.box div p'); 31 - errorBoxContent.text(xhr.s tatusText);41 + errorBoxContent.text(xhr.responseJSON.message); 32 32 errorBox.toggleClass('hidden'); 33 33 if (successBox.is(':visible')) { 34 34 successBox.toggleClass('hidden'); 35 35 } 36 - }).always(function () { 37 37 submitButton.prop('disabled', false); 38 38 }); 39 39 });