I am using CMS Made Simple for my website.
I have some custom PHP code which I would like to call when a users clicks submit on my Form Builder form.
I know my code is now working correctly, but I cannot seem to find where in the FormBuilder code that I can call the function.
I have had a look through the code in the modules directory but I cannot seem to find where I need to put the code.
Preferably I would like to only use this code on certain forms, but if I have to implement for all forms then so be it.
FormBuilder has a field to call UDTs. In the Fast field adder dropdown choose *Call A User Defined Tag With the Form Results" You may have to use Advanced mode
There is also the UDT integration tab.
Related
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.
I have an XFA form (authored in Adobe Designer ES4) with a change event handler defined on a field. When the form is rendered as a PDF and opened in Reader, the change event handler works fine.
However, when importing the XFA into AEM forms (Adobe Experience Manager Forms), adding the field to the AEM form works, but the change event doesn't fire when it is supposed to. I had a change listener setup on a drop-down list. I tried the simple case of a javascript pop-up on any change, but no luck. (Pop-ups do work in AEM)
Offering bounty if someone can reproduce the error, and provide the solution for it. It will probably need some customization in AEM.
Thank you
When you create an Adaptive Form using XFA, change script written in XFA is not executed for all the fields. It is fired only for Radio Buttons and Check Buttons.
So here's the problem. We have some big dojo forms created using Zend_Dojo_Form. The problem is that validation, while working per element, does not work on any of the submit buttons. Due to the inflexibility of the standard layouts, we're compelled to use viewscripts.
I thought I had the whole thing working fine, that was until I needed to make sure that when you went from page to page of the multipage form using the quick links that it submitted the current page (with validation.)
I noticed that when I force-fired the click event on the submit button, no validation was occurring (or rather, there was no preventing the form submission if there were invalid values. Those values just were not submitted.)
So I looked at some tutorials where I found that the form is validated by calling
dijit.byId('form-id').validate();
or the shortcut I was looking for, primarily (originally)
dijit.byId('form-id').submit();
Neither of which are functions, since the byId is returning undefined. What this means is our viewscript - or whatever the whole process is - generating dojo forms with Zend is partly voodoo anyway - does not actually generate the dojo form dijit.
So how does one do this in a viewscript? As in, what sort of php calls or attribs does one attach to the form tag to get it to be interpreted by Dojo to be the basis for a form dijit?
Here is the code from the viewscript:
<form action="<?= $this->escape($this->element->getAction()) ?>"
method="<?= $this->escape($this->element->getMethod()) ?>"
id="case-record-form">
This sounds very similar to a problem I had. If I rendered the form by echoing it, validation worked, but when using a viewscript it would not. I discovered that when using a viewscript, Zend does not add the form to its zendDijits array, so you have to do it manually.
Add something like:
$script = 'zendDijits.push({"id":"MyFormId","params":{"dojoType":"dijit.form.Form"}})';
$this->headScript()->appendScript($script);
at the top of the viewscript.
I'm building a php application that will have many modules/plugins. The issue is that creating smarty template for form's of each plugin and writing validation code for each looks redundant and at the same time using PHP to generate form will restrict the flexibility in controlling each form's layout structure the way I would have wanted.
Using PHP classes and inheritance you can write the validation and layout code once and overriding them whenever you need specific behaviour.
I have a 3 steps forms where I bind for each step on a ViewModel that has DataAnnotation. Everything works fine except that when I click on my "previous" button, the validation gets called and, if there's missing values, the user has to fill all required fields. If I go with an action link, then the data won't be persisted. What I'm looking for here is a way to save my values without calling the validation. I also consider using cookies but I don't think that it's the best way of doing it.
Any ideas or suggestions?
I use separate models for each step of my wizard pages. I also make sure that the previous clicks do not hit ModelState.IsValid which is what triggers the validation check.
I store the results of each step using session state stored in SQL Server. You can also use hidden variables but I didn't like that solution.
Add a comment if you need more detail or show some code for us to see.
Ok after lots of searching I found out a solution for having a Wizard like multiple forms with previous and next buttons that won't call the client validation from Data Annotation and MicrosoftMvcValidation.js. I found this post : jQuery Validation plugin: disable validation for specified submit buttons witch simply add a class to the submit button but it was not working for me so I look again and found this one : http://forums.asp.net/p/1622628/4165648.aspx witch has a solution working for me in javascript : document.getElementById("someButton").disableValidation = true; I would prefer a jQuery solution so I could do something with the class attribute of my buttons but it's working for today and I've spent too mutch time on this.
Hope it helps some else who's trying to do a "Cancel" button or a Wizard like forms in MVC2 and want's to post the form to the controller so he needs to clear the validation.