You are viewing limited content. For full access, please sign in.

Question

Question

Align custom button next to submit

asked on November 7, 2023

I am looking to align a custom button next to the built in submit button.

 Is this something that could be done within the new Forms Designer?  Thanks.

 

0 0

Replies

replied on November 7, 2023

Hi Tommy,

 

The User task allows to add more buttons than the default three buttons, is there any special needs you need this custom button using html field? And I don't think you can align your custom button with submit button easily in new form designer.

0 0
replied on November 8, 2023 Show version history

Hi Zhiyong,

 

I was looking to add a custom button function, to reset the fields within a form.  Also, by chance do you happen to know the onclick button function for submit?  Thank you.

0 0
replied on November 9, 2023

Hi Tommy,

You can bind a onclick event to the custom button like below. But the javascript functionality is limited, you'd better use the built-in LFForms object function that's designed for new form designer.

<button onclick="console.log('Clicked');">Click Me</button>

 

0 0
replied on November 8, 2023

Hide the actual submit button and create your own buttons in html.

0 0
replied on November 8, 2023

Hi Katy, thank you for the suggestion.  This might be what I'll have to go with.

0 0
replied on November 8, 2023 Show version history

EDIT TO ADD:  When I wrote this - I hadn't noticed your part of the post asking about doing it on the new/modern designer.  Unfortunately this won't work in the new/modern designer, and there isn't a way to re-write it so that it would work, because Javascript in the new/modern designer runs within a sandboxed iFrame and doesn't have direct access to the fields and structure of the form that would be needed to move components around like that.  Sorry.

----------------------------

This was tested on the Classic Designer (it won't work on Modern Designer) in Version 11.0.2307.40547.

I added the following to the form using the Custom HTML field element: 

<input type="button" id="clearFieldsButton" class="action-btn" value="Clear Fields">

That action-btn class should get the button formatted the same way as the Submit button.

Then I added this Javascript to the form: 

$(document).ready(function() {
  
  //Hide the custom HTML element that contains the Clear Fields button.
  $('.clearFieldsButton').closest('li').hide();
  
  //Move the clear fields button into the btn-wrapper div element.
  $('.btn-wrapper').append($('#clearFieldsButton'));
  
  //Process the clear fields button click.
  $('.clearFieldsButton').click(function() {
    alert('Clear fields button was clicked!');
  });
  
});

End result is that the Clear Fields button is next to the submit button, but still functions via the Javascript code included on the form:

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.