You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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!
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, hard to tell anything without seeing what you have implemented.
If you follow the demo precisely then you will get the results demonstrated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same example, as originally posted, but with the embedded form
As noted earlier - works absolutely the same way
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your solution you listed on October 15th is now working on my form. Thanks again Alex.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
And as you can see, the reset button is not appearing in the form:
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.