Is this possible to make full dynamic contact form by JavaScript without PHP? - forms

Actually I know that the form validation is possible by JavaScript but confused that after validation, is it full dynamic and don't need to be used PHP at all?

Related

What portions of the marketo code snippet can change?

My company is using marketo forms, and we are generating the page from a content management system.
We'd like to keep the contribution experience as simple as possible and prevent the user from contributing actual <script> tags.
The API documentation says they will give you a block of code that looks like this:
<script src="//app-sjqe.marketo.com/js/forms2/js/forms2.js"></script>
<form id="mktoForm_621"></form>
<script>MktoForms2.loadForm("//app-sjqe.marketo.com", "718-GIV-198", 621);</script>
My question is, what portions of this code are subject to change?
I am sure the 3 part hypen separated string and the integer being passed in can change.
What about the app-sjqe.marketo.com address?
The 3-part string is your Marketo instance ID, and shouldn't really change. The other integer is the form ID, which definitely will change depending on what form you want to embed.
The other thing that you may want to consider, is the other configurable options that you can send along with the form embed. For example, in the module that I have made for my CMS, I let the user put an optional 'thank-you' page URL, to redirect the form to after submission, and also a checkbox to optionally open the form in a lightbox on page load.
The simple module I made is for the Sitefinity CMS - happy to share code with you if that helps!

How to make AJAX calls with Dynamic URLS in HDIV

When I make dynamic URLS in AJAX calls (based on some field value) then how to make HDIV work with this? Since the URL is dynamic HDIV won't know about this URL on server side. This would fail ultimately. Also we couldn't add it to exceptions. Then how to make it work?
These are some options:
Render all possible links, with all possible parameter values. Keep them hidden and choice the right one by JavaScript before submit.
Use a form instead of a link. You can create a hidden form and add multivalue parameters as select fields. Select the right values by JavaScript before submitting the form.
If the previous options are too complex, define the parameter as a startParameters. But note that it will not be validated.

textarea and jsp

I have a textarea that I first print some values coming from a request.getParameter("some_textarea_name"). The user is allowed to modify those values and then I want to get the new values and replace the old ones with the new ones so as to query the new ones and get the results from my database tables. Can I do that without redirecting the user to a new page e.g without using the <form method> and the request.getParameter()
Can I do that without redirecting the user
Yes, you can implement an ajax call that will submit the form without redirecting the user and you can do something with the response (perhaps add it to the page).
If you need help using ajax follow this tutorial, but be aware that it implements AJAX in pure javascript (its a bit more bloated / complicated). If you want to keep it simple look into jQuery ajax, and here is a tutorial too.
without using the
No, you need to use the form to be submitted, however if you use ajax you wont need to redirect the user.

Symfony2 get search via forms and links

In Symfony 2 I tried to create a little search engine. The search consists of a form and some links (like facets on solr). I managed to set up the search form with form binding, creating special searchobject class in entitiess and all this via form post request. For purpose of saving previous searches I saved the complete search object in session serialized.
My question(s) would be:
How to use get requests with a form without outputting form name? Is using forms via get valid in Symfony 2? What is the best practice?
Many sites made with Symfony 2 I see are using www.url.com/search?q=thequery&param2=xxx.
If it's valid, how would I prefill the form? Are there some examples to look at?
(PS: if using the form the way it works now, the url stays the same eg. www.url.com/seach)
Just try to change you html form declaration to specify method="GET".
And that's all, you can create your form as usual. :)

check user availability in forms in jsp

I have a jsp form which takes in user details. On submit button it goes to a jsp page where the details are entered into the database. But before that I would like to check if the username is available as soon as the user clicks the check availability button. How can this be done?
2 ways:
Just redisplay the same page after submitting the form wherein you conditionally display the validation message. This is rather trivial and already covered in the Hello World example in our Servlets wiki page.
Use Ajax to send an asynchronous HTTP request and manipulate the HTML DOM based on the response of the request. This requires a bit more in depth understanding of how websites really work and what JavaScript is. You can find some concrete examples in How to use Servlets and Ajax?
Use AJAX(Asynchronous Javascript and Xml). Its the best web2.0 technology. You can manipulate DOM based on the answer from server