I have used this example (ConfiForms form with drag and drop and REST API - Vertuna WIKI - TEST) to build a dragable form in Confiforms but unfortunately, the 'Ordernr' doesn't update after refreshing the page.
When changing the order of the rows (by drag and drop) in my form and refreshing afterwards, it will fall back to the previous state. Is it possible that the rows remain in the new order?
Welcome to this community!
The question is tagged with cloud and confluence-cloud... I dont think there is a possibility to do what you want in the cloud.
The example you refer to is for server/dc
I have verified that example just now and it works fine for me - what exactly do you have? Let's see what is different
Alex
thanks for your reply.
Since I never worked with Confluence/Confiforms before, I am the excact opposite of an expert. I can access my company's confluence page via browser, when I am connected into their network (VPN) and therefore, thought that it is cloud based, so maybe it is hosted on a server. I honestly don't know. Sorry.
However, I copied the sourcecode given under above mentioned link and get the non-persistant result described. After refreshing the page, the 'Ordernr' gets set back to the order number that I've assigned in the registration form beforehand.
Is it possible that my form saves the new positions (new 'Ordernr') after Drag-and-Dropping them into the new position I need?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you changed the code to match your form and page id?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have changed the formname of the ConfiForms Form Definition from "f1" to "f".
Thats all I changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If its relevant, here is the codeblock I am using right now:
<p>form</p>
<ac:structured-macro ac:macro-id="4f63e526-ab65-4a59-8cf7-baff43e3bf29" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="6b21d235-3cb2-4f1c-b95c-1a7b09df9071" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="5f9ed3ad-449d-4a85-bdb7-d4b92262356c" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">title</ac:parameter>
<ac:parameter ac:name="fieldLabel">Title</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="9cd1501b-4577-42ca-9f55-a219b455d126" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">ordernr</ac:parameter>
<ac:parameter ac:name="fieldLabel">OrderNr</ac:parameter>
<ac:parameter ac:name="type">numberhidden</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="0f086456-1234-4143-bc47-80115ccce664" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="fieldName">ordernr=([entry.ordernr]+1)</ac:parameter>
<ac:parameter ac:name="action">Lookup and set value</ac:parameter>
<ac:parameter ac:name="values2">f:12222999</ac:parameter>
<ac:parameter ac:name="values3">ordernr DESC LIMIT 1</ac:parameter>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>records</p>
<ac:structured-macro ac:macro-id="4cc00cf5-1070-4a28-824f-b0d7ec842421" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:parameter ac:name="sort">ordernr ASC</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="c3b75cf6-477a-49b2-9f8e-d9267c81dceb" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">ordernr</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="33d8e448-f88d-4f62-94b7-05ba87601181" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">title</ac:parameter>
</ac:structured-macro>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="c0a424df-5b20-486c-8045-71b66e9e9814" ac:name="html" ac:schema-version="1">
<ac:plain-text-body><![CDATA[<script>
var fixHelperModified = function(e, tr) {
var $originals = tr.children();
var $helper = tr.clone();
$helper.children().each(function(index) {
AJS.$(this).width($originals.eq(index).width())
});
return $helper;
},
updateIndex = function(e, ui) {
AJS.$('td.cf_ordernr', ui.item.parent()).each(function (i) {
AJS.$(this).html(i + 1);
});
AJS.$(".cf_f_table tbody").find('tr').each(function(i, tr){
var entryId = AJS.$(this).attr('confi-data-id');
AJS.$.ajax({
url: 'https://wiki.vertuna.com/ajax/confiforms/rest/update.action?pageId=12222999&f=f1&q=id:' + entryId + '&fv=ordernr:' + (i+1),
type: "GET",
cache: false,
async: false,
success: function (data) {
}
});
});
};
AJS.$(".cf_f_table tbody").sortable({
helper: fixHelperModified,
stop: updateIndex
}).disableSelection();
</script>]]></ac:plain-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The code uses page id 12222999, which is the id of the page where the example is located.
You need to adjust it to match yours
And it also uses form name f1 (in the code)
f=f1
So, if you changed that you need to adjust that as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much, it worked.
I had to change this URL in the source code:
https://xxx.yyy.com/ajax/confiforms/rest/update.action?pageId=1122486467&f=f&q=id:
whereas xxx and yyy is the URL of my institution and 1122486467 the PageID for my specific page.
At the end of the URL I changed "f=f1" to "f=f" because I renamed the "Confiforms form definition Form Name" from "f1" to "f".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.