Asp.net Core Form - On Form Submit Show success/failure message - asp.net-core-2.0

I have created the simple chtml form in Asp.net Core view.
Now,
1. When Form is submitted then I want to Check Validation First which is implemented using bootstrap.
When Validation check successful then the form should get submitted
Once form get submitted successfully then want to show a message that "Form has been saved successfully"
Here Issue is When I changed button type from Submit to button, and used Jquery Ajax call then I'm able to Show message on Ajax success method.
But Bootstrap Validation doesn't work as they need form should be posted.
I expect Bootstrap Validation should work first and Once validation is successful then OnSubmit button form should be posted and once form get posted successfully, want to Show alert message.

Related

Routing from http POST to http GET in Express

I have some questions about routing using Node.js and Express.
I have a running application where you can add items in different ways (e.g. via 'URL'). Let´s describe that further:
I have to different routes:
/create: Choose adding option in a form with dropdown list (e.g. via 'url')
/create/validate: Form which shows the retrieved data
/create:
When pressing the "Add" button on my main page an GET request on this route will render a form where you can choose the inserting option.
In this form you can choose in a dropdown list one option (e.g. 'URL') and press the "Submit" button. The POST request collect the entered information which are available inside the req.body.
Before sending the entered data to my database I want to perform a validation. That means, the entered data is rendered in a validation form (which is shown to the user) on route /create/validate.
The problem here is, that I can´t send the entered data from /create POST request to the /create/validate GET request for the form.
Right now my /create POST request is redirecting to the /create/validate route and saving the url content in a local variable, which can be then accessed in my /create/validate GET request for further processing.
So summing up:
I want the entered data of the /create POST request available in the /create/validate GET request.
Is there any other way instead of saving the content to a local variable?
The best way is just keep a global variable somewhere outside your http handlers. That data will stick around, between request, on the server side, as long as the node process is running.
Otherwise an other solution is using localstorage for node.js
https://www.npmjs.com/package/node-localstorage

How to display 2 separate functionality by using a p:commandButton onclick/action listener

I have a usecase where there will be a webservice call in the backend when clicked on a button. I have used p:commandbutton.If the web service call is successful then I need to display an overlaypanel with a message and if not successful, I need to show an error message. The necessary web service call is invoked from the button click. But how to capture the response if it is successful or not, and then display either the overlaypanel Or error message based on the response.
Is there any way to capture the response in the xhtml after the action invoked through actionListener ajax command button.

How to post data from NetSuite to other webservice

I have data in the NetSuite. We have provided button in NetSuite. I want to perform HTML Form Post operation on this button click, so that web end point accepts that data and presents on UI.
On button click, we want to simulate HTML Form submission.
How this can be achieved?
You have jQuery 11.1 loaded by NetSuite on every page. You can create an inline HTML field with your Javascript/jQuery code.
Just bind a function to the click event of the button. In that function you can use .ajax to perform an HTTP POST or .post to make a form submission to the server.
Don't forget to set e.preventDefault at the beginning of your function.

SuiteScript 2.0 detect change on custom field with client script

I deployed a client script that handles a click event on a custom button. When I click the button, I may an api call to get data and the field is populated with the data. This part works great, but when I go to save the new information on the record, I get this alert:
The record has not changed. Do you really want to submit it?
Is there some way to trigger a form changed event or something similar?
try setWindowChanged(window,true)

Browser back button navigation

Whenever browser back is clicked, it must not navigate to the previous page but to some default page. how is it done using JSF ?
Clicking on browser back button requests the result page from the browser cache.
This is a client side activity. It doesn't send request to your server for fetching some default page(in your case).
Please refer this post for writing a filter indicating the browser not to cache dynamic JSF pages.
And also you can refer this one for more details.
You can try to detect if User has clicked on browser back button by writing client side code.
Refer this post for detecting back button click.
If you are trying to alter the behaviour of browser back button, it indicates some kind of flaw in your application.

Resources