How to collect user input and submit data to a javascript function?

m4trix.dev
36 Posts
m4trix.dev posted this 01 February 2022
Ask a Question

Hello,

I would like to add input element in my page like checkbox and pass the value of each element to a javascript function. I do not need to submit form to the server, I just need to give the user an option to select certain boxes and then submit. What is the best way to achieve this in Nicepage?

thanks

Hello, I would like to add input element in my page like checkbox and pass the value of each element to a javascript function. I do not need to submit form to the server, I just need to give the user an option to select certain boxes and then submit. What is the best way to achieve this in Nicepage? thanks
Vote to pay developers attention to this features or issue.
5 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 02 February 2022

Hi,

In general, an HTML form is just a place where you can enter the data in a browser. It does not do anything. Nicepage Contact Form is a simple HTML form. So you can create the Nicepage Contact Form with the desired fields and add a custom script that can do what you need with the form data. Or you can use the HTML element where you can insert any desired HTML, CSS, or JS.

Please let us know if you have any further questions.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, In general, an HTML form is just a place where you can enter the data in a browser. It does not do anything. Nicepage Contact Form is a simple HTML form. So you can create the Nicepage Contact Form with the desired fields and add a custom script that can do what you need with the form data. Or you can use the HTML element where you can insert any desired HTML, CSS, or JS. Please let us know if you have any further questions. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
m4trix.dev
36 Posts
m4trix.dev posted this 06 February 2022

Hello. Thanks.

I have managed to create the form. When the user clicks submit it is redirected to another page (I have added the link in the submit dialog). This is fine but I also want to run a script before moving to the new page. At the moment I am manually adding the following html code in bold after the project is exported to html:

form action="link" method=post **onsubmit my-js-function;”**

The scrip does some work and then return true.

Is there a better way to achieve this in nicepage. I can’t see how to add a script to a form. The limitation of my current approach is that I need to add the onsubmit text manually EVERY time I export the project to html.

Thanks

Hello. Thanks. I have managed to create the form. When the user clicks submit it is redirected to another page (I have added the link in the submit dialog). This is fine but I also want to run a script before moving to the new page. At the moment I am manually adding the following html code in bold after the project is exported to html: form action="link" method=post **onsubmit my-js-function;”** The scrip does some work and then return true. Is there a better way to achieve this in nicepage. I can’t see how to add a script to a form. The limitation of my current approach is that I need to add the onsubmit text manually EVERY time I export the project to html. Thanks

Last edited 07 February 2022 by m4trix.dev

Support Team
Support Team posted this 07 February 2022

Hi Matteo,

Unfortunately, Nicepage does not provide the option to edit form HTML directly in Nicepage, but the Form button has its own class that you can use to assign some action via javascript. The Form itself has the class and name attributes too.
Please let us know if you have any further questions.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi Matteo, Unfortunately, Nicepage does not provide the option to edit form HTML directly in Nicepage, but the Form button has its own class that you can use to assign some action via javascript. The Form itself has the class and name attributes too. Please let us know if you have any further questions. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
m4trix.dev
36 Posts
m4trix.dev posted this 07 February 2022

Hello, thanks for the feedback.

Can you give me an example on how I can assign some action via javascript using the form button class?

Hello, thanks for the feedback. Can you give me an example on how I can assign some action via javascript using the form button class?
Support Team
Support Team posted this 10 February 2022

Hi Matteo,

Unfortunately, we offer support for Nicepage only. There is nothing specific to Nicepage itself. Therefore, we recommend that you search for ready solutions via js or jquery all over the internet.
The contact form button is an HTML link with the class "u-btn-submit".
We recommend that you try to unbind the existing submit button click event and bind it with your function via jquery.
Depending on the desired result, you can also hide the existing submit button and new Button or HTML element with the desired button and click action below the form element.

Please let us know if you have any further questions.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi Matteo, Unfortunately, we offer support for Nicepage only. There is nothing specific to Nicepage itself. Therefore, we recommend that you search for ready solutions via js or jquery all over the internet. The contact form button is an HTML link with the class "u-btn-submit". We recommend that you try to unbind the existing submit button click event and bind it with your function via jquery. Depending on the desired result, you can also hide the existing submit button and new Button or HTML element with the desired button and click action below the form element. Please let us know if you have any further questions. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
You must log in or register to leave comments