Hi i want to use captcha in an html form in a Symfony 3.4 project , i installed and implemented the captcha bundle (Gregwar's CaptchaBundle)successfully but in the bundle's documentation in the part of adding the captcha to the form they are working with symfony form builder but i am working with normal HTML form using requests .
this is the code they provided in the bundle's documentation :
<?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ...
$builder->add('captcha', CaptchaType::class); // That's all !
// If you're using php<5.5, you can use instead:
$builder->add('captcha', 'Gregwar\CaptchaBundle\Type\CaptchaType');
// ...
this is my html form where i want to add the captcha
<form class="row" method="post" action="{{path('envoyerchat')}}">
<input type="text" name="test2">
<input type="text" name="test1">
<!-- add captcha here -->
<!-- add captcha here -->
<input type="submit">
</form>
can i convert that code which works with fom builder to my html form ?
Related
We implemented a simple nuxt app with a basic form and deployed it to netlify.
When pressing the "Submit" Button of the Form, we receive a 404.
Here you can find the link to the deployed netlify app:
EDIT -> Removed Link
After looking through the troubleshoot guide, they listed that the added "netlify" or "data-netlify="true" attributes should not be visible if netlify recognized your form, but they are.
Plus the form can't be found in the "form" configuration tab of the netlify backend.
Nuxt config:
SPA
Tailwind
We tried to add the necessary attributes for netlify:
netlify or
data-netlify="true" & netlify-honeypot="bot-field"
We also added a "pre-render" library called prerender-spa-plugin.
Here you can find the contact.vue page content.
Simple form with "name" attributes set according to netlify documentation.
<template>
<div>
<form name="contact" method="POST" data-netlify="true" netlify-honeypot="bot-field">
<p class="hidden">
<label
>Don’t fill this out if you're human: <input name="bot-field"
/></label>
</p>
<p>
<label
>Name
<input
type="text"
name="name"
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white;"
/></label>
</p>
<p>
<label
>Email
<input
type="email"
name="email"
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white;"
/></label>
</p>
<p>
<button
type="submit"
name="submit"
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"
>
Send
</button>
</p>
</form>
</div>
</template>
<script>
export default {};
</script>
<style>
.hidden {
display: none;
}
</style>
It would be great if we can manage to fix this, so that netlify finally recognizes our form.
Netlify comes with built-in form handling. Our build bots do it by parsing your HTML files directly at deploy time, so there’s no need for you to make an API call or include extra JavaScript on your site.
The form is required to be in the rendered files at deploy time. The problem with SPA mode is that none of your pages are actually rendered as HTML. You can check this by right clicking the page, and clicking "View Page Source". You won't be able to find the form.
Netlify addresses this problem here in their docs.
They have a specific post for fixing this for a Vue app here
A little more digging on the the issue and we find a Nuxt solution here:
Place the following in static/form-dummy/index.html:
<form name="MYFORM" action="/form/success" netlify>
<!-- form controls here -->
</form>
Place the following in pages/form/index.vue (Or whenever you've named your Vue file)
<form name="MYFORM" action="/form/success" method="post">
<input type="hidden" name="form-name" value="MYFORM" />
<!-- form controls here -->
</form>
From the post:
You just need to make sure you add that hidden in the Vue component so that Netlify recognises the form submission as associated with the form called MYFORM. I think you also need to ensure all the inputs you want to receive data for are on both forms.
I'm having trouble with a global variable, I think it might be pulling its data from a HTML Form Input, but I can't find any documentation on the web about global var pulling data from a HTML Form Input.
Thanks.
When a form is submitted the method tag specifies if it is a POST or GET request. Depending on what method your form is using your form values can either be in your $_POST or $_GET Super global.
Example:
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
After the submit button on the form is clicked the form contents can be found by referencing the name attribute in the super global(In this case the POST).
$_POST['name']
$_POST['email']
For documentation see
http://php.net/manual/en/reserved.variables.post.php
This applies to PHP 4 >= 4.1.0, PHP 5, PHP 7 ie. fits PHP 5.3.
When creating a custom view in joomla with multiple forms, there is a conflict because each form has the id="adminForm" name="adminForm".
Renaming the form causes incompatibility with joomla.
How can I display multiple adminForm's on a single view?
Restructure the form elements into a single page-encompassing form
and remove the &task=controller.task portion from the form action
URL, e.g.
<form
action="<?php echo JRoute::_(''); ?>"
name="adminForm" id="adminForm" class="form-validate"
method="post" enctype="multipart/form-data">
On each submit button use the joomla method: onclick="Joomla.submitbutton('controller.task')" e.g.
<button type="submit"
onclick="Joomla.submitbutton('group.join')">Join</button>
Joomla will automatically update a hidden field with the name="task" and value="controller.task" which will get submitted with the form.
You need to have this element in your form for it to work, e.g.
<input type="hidden" name="task" value="" />
</form>
I have a html page and i am sending some parameter using post method.
now i want to get these parameter on gwt client.
is there any method in gwt to get post parameter on client.?
i use following code
<html>
<body>
<form action="http://localhost:8080/popnnn/js.html" method="post">
<input type="text" id="foo" name="foo">
<input type="submit" value="Send" name="submit" id="submit">
</form>
</body>
</html>
and in my gwt code
TextBox text=new TextBox();
text.setText(Window.Location.getParameter("foo"));
this is perfectly woking with get method but not with post
please help......
Steps to follow:
Just convert the file js.html to js.jsp.
Get the post parameter from the request parameter.
Set the value in hidden div in JSP and access it in JAVA.
Change the action attribute of form tag as shown below:
<form action="http://localhost:8080/popnnn/js.jsp" method="post">
Try any one:
JSP Scriplets
<div id="fooParameter" style="visibility: hidden;">
<%=request.getParameter("foo") %>
</div>
JSP Standard Tag Library
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div id="fooParameter" style="visibility: hidden;">
<c:out value="${param.foo}" />
</div>
Access value from hosted HTML/JSP to JAVA code
String foo = RootPanel.get("fooParameter").getElement().getInnerHTML();
TextBox text=new TextBox();
text.setText(foo);
Find a sample code here about Acces value between two jsp with jstl
Our JBoss form is posting the parameters in the URL instead of in the request despite being a POST form. I have confirmed that the form is post in the actual page using Firebug. Note that this is within a portlet.
We are submitting the form using javascript like:
function submitForm(action, time)
{
document.getElementById("pageActionInputID").value = time;
document.getElementById("timeSpanFormInputID").value = action;
document.getElementById("formID").submit();
}
<form action="<portlet:actionURL></portlet:actionURL>" method="POST" id="formID">
<input type="hidden" name="pageAction" id="pageActionInputID" />
<input type="hidden" name="timeSpan" id="timeSpanFormInputID" />
</form>
where 'portlet' is from
<%# taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
Any ideas why we are getting the inputs in the URL?
Here is what the resulting markup looks like:
<form id="formID" method="post" action="/portal/auth/portal/myTab?action=1">
<input id="pageActionInputID" type="hidden" name="pageAction"/>
<input id="timeSpanFormInputID" type="hidden" name="timeSpan"/>
</form>
Though it would be great if someone could confirm it. I think the JBoss Portlet throws out post/get and uses action URLs instead.
A descriptive article about render and action URLs