How to check when a form was rendered in Laravel - forms

Upon a form a submission, I wish to determine the time that a Laravel form (built using the Laravel Collective HTML package) was rendered to the user.
I need to check this date upon submission for a variety of reasons.
I have a large existing project and am considering the best way to get this date. I was reading the CSRF middleware (since this token is already included in all forms) to see if it can be extracted from that, perhaps in another middleware adding something like form_generated_date to the request.
It looks like a bit of a stretch, if possible at all. So now I am looking at adding a custom field to every form.
I would like this to be included in all forms, just as the Form::open() method will add the CSRF token. I found information on adding my own macros, but not about extending this method.
Does anyone know if it's possible to get the date from a CSRF token? Or how (or where the documentation is) to extend the Form::open() method.

The Form::open() method looks to be in the FormBuilder.php file (https://github.com/LaravelCollective/html/blob/2f6dc39ab3655724a615fe8a652d8b7f04fc9ac6/src/FormBuilder.php).
This file can be found in /vendor/laravelcollective/html/src/FormBuilder.php
You should be able to add a new hidden form field to the open method, bearing in mind that this will be overwritten in any updates. Not really recommended, but will achieve what you are looking for.

Related

Hook into TYPO3 form creation

I'm looking for a hook to hook into the creation of a frontend form in TYPO3 (e.g. a contact form) which will allow me to pass the form structure to my extensions the moment a form is created (or edited).
I'm not so sure where to look, and I have asked before, but might have formulated my question unclear. Does anyone know if such a hook exists, or is available in the new formengine of TYPO3 8?
Or if you have a better solution I could use, I'm open for everything.
Thanks!

Adding attributes to cq5 form using FormsHelper

I'm trying to add an attribute to the form tag of a cq5 form. I noticed that the output is generated using
FormsHelper.startForm(slingRequest, new JspSlingHttpServletResponseWrapper(pageContext));
I was curious how I can either:
alter the request so that the formHelper prints the form w/ the attributes I need
Hook into the actual print out to include the attributes I need.
Any help or direction would be good.
note:
I've already checkout out the javadoc for formshelper, done some searching via goolgle, and dev.day.com including the dev.day.com doc on developing forms.
thank you
API doesn't allow you to add any attributes to this tag. You can only specify desired CSS classes adding css property to the form component. Of course, you can also create component sling filter and response wrapper to rewrite created form, but it seems to be an overkill. I think better solution is using JS to add attributes client-side.

Any wordpress form building plugin for my requirements?

I'm looking for a WP plugin which can allow me to create different forms and embed them on pages and following are the requirements:
Only a single textbox required in each of those forms
The submit button will only be shown if a custom entry/answer is inputted into the textbox. (basically a client-side validation)
The submitted answer should be stored in the back-end with the usermeta (or just the username of the user logged in) so that I can export the entries in a format like csv, etc.
Any thoughts?
P.S. I have found one but not sure if the PRO version of this allows me to have a validation for a custom text. This is the plugin: http://wordpress.org/extend/plugins/visual-form-builder/
Gravity Forms is the most robust form builder plugin for WordPress. You can, with the right knowledge and skills, make it do pretty much anything you'd like. You can find it here: Gravity Forms.
Very well, I've found this. There are actually good plugins however, you will have to purchase it. I'm looking for a free one. http://www.webdesignboom.com/2013/formcraft-wordpress-form-builder/

Spring form field id with dot doesn't work well with jquery

When I build a form I need to use a dots in path variable. When html is generated inputs has dots in ids. There is a problem with third party jquery plugins like validators. They doesn't work well with dots. Is there a way to change all dots into eg. "_".
One solution would be not to use automatic form binding, so instead of using <spring:form/> you might still use plain HTML tag <form> and handle it regular way. It all depends if you want to benefit from Spring's mechanisms like automatic form field binding and error handling. But if you are handling form validation with JavaScript and you plan to do it across the whole project, you might want to make that effort. What I usually do is to handle client side and server side validation with JavaScript (plain and AJAX), so I'm not using <spring:form/> at all.

Best Practice creating Forms in Wordpress

I was wondering what is the best practice for creating forms in Wordpress? As a developer I hesitate to use a plugin like CForms, but I can understand why someone would like to use it. In the end I want to know the following:
What is the best practice for creating forms in Wordpress? (Custom HTML/CSS with Javascript and PHP validation or just using a specific aspect of the Wordpress API?)
I don't use any part of the WordPress API for forms. You could automatically grab the name and e-mail address out of the cookie WordPress creates when someone leaves a comment, if you want to try to auto-populate some fields.
An easy way to handle forms is to use Page Templates. That lets you create a new PHP file for a specific page, overriding the default page template of the theme. Then you can simply have the form post to itself and this one page template handles the processing as well.
http://codex.wordpress.org/Pages#Page_Templates
A lot of what's available for WordPress in the way of addins, and what gets a lot of attention, is stuff that I find makes little use if you have programming and general web skills. Almost always they seem to (necessarily) overgeneralize a requirement with a zillion options and configuration requirements because they are first of all designed for non- or barely-programmers.
Just learn the fundamental paradigms, scratch your head and wonder why nothing is consistently abstracted and/or encapsulated, get over it, and use what you already know about php and HTML-based forms. WordPress doesn't add much in the way of either tools or constraints.
I find the Widget feature applies usefully to most everything these days, and Forms is a candidate. But that's my own WordPress viewing prism - YMMV.
What do you mean by "in Wordpress"? Do you just mean placing the form HTML in a Wordpress template? Or storing data collected in the Wordpress DB? If you just want to create a form on your site, there's nothing Wordpress-specific to worry about. I believe there's some special Wordpress data facilities you can use if you're creating a widget or plugin or whatever they're called now. But if you're not, just create the HTML, and point it at a target URL that processes the values and puts them in a DB, Wordpress or otherwise. That target URL could be a separate PHP resource, or the same page. If it's the same page, you just need to include your PHP somewhere in the main Wordpress flow.