Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Simple way to toggle a reset of all confiforms fields

Looking for a simple way for an end user to toggle a reset of all fields on a form. I know that the Confiforms rule "reset" will achieve this to an extent, however, I'd love to have a JavaScript driven button float at the bottom of the form so the end user has easy access to a reset function. Is this doable? Any help is appreciated, thanks!

2 answers

1 accepted

2 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 25, 2021

Hi Jason!

Great question!

Well, you can easily add anything you want into the "form dialog initialization", including something like an "extra button" with custom function

See the quick demo below

http://recordit.co/Efi5wlcetE 

Hope it helps

Alex

This is exactly what I was looking for. As for the function to reset the field values, my JS is far from excellent, how would I go about doing that in the function?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 25, 2021 • edited

A lot depends on what field you want to reset... 

Could be as easy as (for many field types it works)

AJS.$('#' + formId).find('#i_mytext').val('');

(where "mytext" is my text field value on a form)

And much more complicated is to reset "drawing canvas" in ConfiForms, and some other field types...

Like Loren likes this

This is perfect! Implemented and works as intended. Thanks so much Alex!

@Alex Medved _ConfiForms_  I followed this solution however it is hiding the entire form and now I am only seeing the paragraph above the form and form isn't showing on the page.

I am doing it as a Rendering Form as Embedded. Is there a solution that works with the rendering form as embedded where I can still add a reset button?

I did include the  code you used in the example at the bottom within the ConfiForms field definition box. 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 11, 2022

Sorry, hard to tell anything without seeing what you have implemented. 

If you follow the demo precisely then you will get the results demonstrated

Let me provide some more detail then to show how I built my form.

I have at the top ConfiForms (FormView Registrations Control)

ConfiForms Form Name:TARF

Rendering Form as: Embedded 

Label for Registration Button:Submit

Override Label for Save Button: Submit

Override Label for form Close Button: Reset

Message to show after a record has been created: Your Form has been submitted 

Execute custom Javascript function after the form is loaded: myCustomScript(formId);

Within the Confiforms Form Registrations Controls 

I have Confiforms fields over 10 of them including Title, Type of Request, Product, etc.

Separate from the above below it

I have ConfiForms Form definition with over 10 of them including Title, Type of Request, Product, etc.

And underneath that I have the HTML macro that has the javascript listed in your demo.

The issue I’m having is when I put in the information I no longer see ConfiForm fields on the confluence page after I publish it they go away and are becoming hidden after adding Execute custom Javascript function after the form is loaded myCustomScript(formId)

The ConfiForm fields/request form only displays everything when I select rendering for as a button. It hides.  The ConfiForm fields/request form on the page when I select rendering for embedded.

But I need to be able to see the request form on the page and then at the bottom submit button and reset button when the user goes to the page.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 12, 2022

Same example, as originally posted, but with the embedded form

http://recordit.co/HpwBNR3Zkm

As noted earlier - works absolutely the same way

Alex

Like Loren likes this

Thanks a lot Alex. I do now see a Reset button next to Submit on my form in Confluence. After following your embedded demo.

But one more question 

AJS.$('#' + formId).find('#i_mytext').val('');

As you mentioned here somewhat higher on this page and in this example . Now with my reset button how do I get it to  for example reset  ConfiForm field definition  Field Name Apps Field Label Software Field Type Drop down

Connected to it

confiform field

field name Apps

Override Label Software Apps

 Where the reset button resets the Confiform fields.

Thanks

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 13, 2022

You can either use/add the JS code as in the demo

AJS.$('#' + formId).find('#i_mytext').val('');

Changing mytext to match your field names or by using our APIs/code  

https://wiki.vertuna.com/display/CONFIFORMS/JavaScript+functions

function cfSetValue(formId, fieldName, fieldValue, isAdvanced = false)

Rewriting the example above with mentioned functions

cfSetValue(formId, 'mytext', '');

Resetting the value of an advanced dropdown should be done via

cfSetValue(formId, 'mydropdownfield', '', true);

Alex

Like Loren likes this

Thanks again Alex. The JavaScript solution worked on my form for fields with drop downs and the fields that are text area (the reset button is working for that) except it's not working for the field names that are field type multi select or text box group.  Do I need to add something additional for multi select and text box group field types for the javascript solution?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 15, 2022

Hi

Try with "advanced" flag set to true

cfSetValue(formId, 'mydropdownfield', '', true);

 for multi-select fields.

Not sure though what is a "text box group" field

Alex

Like Loren likes this

I meant to say field type Checkbox Group not Text box group.

 

<script type="text/javascript">

function my CustomScript(formId) {

AJS.$('#' + fomdId).find('.save-cf-btn').after('<button type="button"` class="aui-button cf_reset_btn" style="margin=right: 10px;">Reset</button>');
AJS.$('#' + formID).find('.cf_reset_btn').click(function() {
 AJS.$('#' + formID).find('#i_totr').val('');
 AJS.$('#' + formID).find('#i_title').val('');
  });
}

function cfSetValue(formId, 'my multiselect field', '',
true);
}); }
</script)

 

 

The above code is working in resetting the drop down fields and text fields (with the reset button) but its not working in resetting the multi select and checkbox group fields. I tried doing the above. What do I need to change regarding cfSetValue function, for this to work?  

 

 

Your solution you listed on October 15th is now working on my form. Thanks again Alex.

Elena Rodriguez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Jul 27, 2023

Hi @Alex Medved _ConfiForms_ 

I was looking to something similar to this 'reset fields' feature, and I found your solution, that I'm trying to replicate with no luck

I copied your exact solution, but I cannot see the Reset button appearing in the form.

Could you help me find what I'm doing wrong??

This is what I created:
Confiforms config.png
And as you can see, the reset button is not appearing in the form:
NoResetButton.png

Thanks

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 27, 2023

Hi, 

Have a look more carefully what you have in your script... it is full on typos

fomdId

formid

to name a few... It is just a broken script

Alex

Elena Rodriguez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Jul 28, 2023

Hi @Alex Medved _ConfiForms_ 

Of course... sorry for that. I fixed the typos and also removed the newline feeds and it's working fine for me

I have another question:

I have a form with a voting control field. Then I have created a table view to show the records and allow people to vote.
votingControl.png
I know there Voting control allows to remove votes one by one, but... is there anyway that I can add a button (or something) to clear all votes from all records?

Thanks a lot

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 28, 2023

Makes sense to open a new question (easier for others to find relevant contents, cleaner discussion, clearly visible answer), but here is what you can do:

http://recordit.co/3TmvSEcbtz

Alex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events