genemu / genemuformbundle Goto Github PK
View Code? Open in Web Editor NEWExtra Form : Captcha GD, Tinymce, Recaptcha, JQueryDate, JQueryAutocomplete, JQuerySlider, JQueryFile, JQueryImage
Extra Form : Captcha GD, Tinymce, Recaptcha, JQueryDate, JQueryAutocomplete, JQuerySlider, JQueryFile, JQueryImage
I am trying to run Your GenemuFormBundle, because that is exaclty the things i need in my project but I stacked.
This is configuration I have:
In Kernel
new Genemu\Bundle\FormBundle\GenemuFormBundle(),
in autoload
'Genemu' => DIR.'/../vendor/bundles',
In config:
genemu_form:
date: ~
tinymce:
script_url: '/tinymce/jquery.tinymce.js'
image: ~
file:
uploader: /uploadify/uploadify.swf
In sonata news:
public function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title', NULL, array (), array ())
->add('description1', 'genemu_tinymce', array (), array ())
->add('image', 'genemu_jqueryimage', array (), array ())
->add('createdAt', 'genemu_jquerydate')
;
}
In layout:
<script src="{{ asset('js/jquery-ui-1.8.17.custom.min.js') }}"></script>
<script src="{{ asset('tinymce/tiny_mce.js') }}"></script>
<script src="{{ asset('js/uploadify/jquery.uploadify.v2.1.4.min.js') }}"></script>
<script src="{{ asset('js/uploadify/swfobject.js') }}"></script>
<script src="{{ asset('js/jquery.Jcrop.min.js') }}"></script>
There is no error, but I don’t see any tinymce and other stuff.
Hi,
I opened an other issue because this time it's no more a feature request.
So the issue is regarding this code (on symfony2.0.4) :
<?php
$builder->add('lieux', 'genemu_jqueryautocompleter', array(
'route_name' => 'lieu_request',
'multiple' => true,
));
lieux is a manyToMany association in my entity and lieu_request is a valid route.
This leads me to this error :
Expected argument of type "array", "Doctrine\Common\Collections\ArrayCollection" given
in vendor/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToChoicesTransformer.php at line 34
This means the ArrayToChoicesTransformer is called, and this is because the parent class of JQueryAutocompleterType is given by:
public function getParent(array $options)
{
return $options['widget'];
}
and due to the default $options['widget'] is choice, the parent is the choice type.
This is good if there is no ajax autoloading, but in this case I think it's not wanted.
Maybe it's again a mistake from my part ^^
Ibiz
By default, the bundle generate 4 bundles: small, medium, large, extra.
I would like to use only one thumbnail so I tried to set the config file as follow:
genemu_form:
image:
thumbnails:
large: [300,300]
filters: ['bw', 'negative', 'crop']
Unfortunately, it gives the error :
InvalidTypeException: Invalid type for path "genemu_form.image.thumbnails.large". Expected scalar, but got array.
I am not really used to the configuration stuff, so I can't help you any further for the moment.
Any fix would be appreciated.
Thanks!
Note: This was tested on the 2.0 branch
Hi,
I've just updated the bundle.
Did you changed something for genemu_jquerychosen field type?
Could not load type "genemu_jquerychosen"
Thanks
Not sure if this is bug or feature, but when 'years' is not specified explicitly then exception is thrown.
I'm trying to use you bundle in my project to upload an image to the server.
# config.yml
genemu_form:
file:
enabled: true
uploader: /static/uploadify/uploadify.swf
# routing.yml
genemu_upload:
resource: "@GenemuFormBundle/Controller/UploadController.php"
type: annotation
// FormType.php
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('image', 'genemu_jqueryfile');
}
{# in my form file #}
<link rel="stylesheet" type="text/css" href="{{ asset('/static/uploadify/uploadify.css') }}" />
{{ form_stylesheet(form) }}
<script src="{{ asset('/static/uploadify/jquery.uploadify.js') }}" type="text/javascript"></script>
{{ form_javascript(form) }}
When I load the page it shows the SELECT FILES button, but the SWF isn't loaded. When I check my developer console I see the following error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error). The resource is the uploadify.swf, but it's trying to load it from app_dev.php/route/uploadify.swf instead of app_dev.php/static/uploadify/uploadify.swf
The script_url setting should be processed by asset(), so the real path will not be dependent on the projects path.
Suggested fix in fields.html.twig at line 5:
jQuery('#{{ id }}').tinymce({{ configs|merge({'script_url': asset(configs['script_url'])})|json_encode|raw }});
Hi,
file Genemu\Bundle\FormBundle\Resources\config\jquery.xml (line 14):
<parameter key="genemu.form.file.upload_dir">%genemu.from.file.root_dir%/upload</parameter>
from => form
help!!!!
Fatal error: Declaration of Genemu\Bundle\FormBundle\Form\JQuery\Type\AutocompleterType::buildForm() must be compatible with that of Symfony\Component\Form\FormTypeInterface::buildForm() in /home/www/integral/src/Genemu/Bundle/FormBundle/Form/JQuery/Type/AutocompleterType.php on line 137
form type:
->add('Cliente','genemu_jqueryautocompleter_entity', array(
// 'route_name' => 'cliente_ajax',
'class' => 'Area4/ContableBundle/Entity/Cliente',
))
My english is bad, sorry.
File: Genemu\Bundle\FormBundle\Resources\views\Form\div_layout.html.twig
Line: 13, 18
Iframe with Re-Captcha not visible in my form, because tags hide it. Maybe this tag should be deleted.
Hello,
I've successfully added captcha type ito my form.
Now I'd like to make some customizations (in the config.yml) regarding:
genemu_form:
captcha:
enabled: true
background_color: 'FFFFFF'
border_color: 'FFFFFF'
which doesn't seem to give any effect (defaults colors used)
or
genemu_form:
captcha:
enabled: true
fonts: ['akbar.ttf']
which throws:
InvalidTypeException: Invalid type for path "genemu_form.captcha.fonts.0". Expected array, but got string
Hope that can be fixed :)
best regards,
KK
Hi all,
is it possible to launch a javascript when I select an entity with jqueryautocompleter?
I want to launch a jquery script when I select a product that fills others field of my form.
For example: Suppose that we have an order form with:
Now I want to call a javascript when I select a particular product in the jqueryautocompleter widget. Then the javascript loads the price field (with an Ajax call to a php page that gets the product's price from the products table of the data base). For this pourpose I need to retrieve also the id (or the complete entity) of the products I have selected.
Is it possible?
Thank you so much!
Eric
Everything is in the title.
William
I would like to use your bundle but not for the "genemu.form.entity.type.ajaxentity" as I don't use doctrine. But actually there is a dependency with doctrine (just for this field type.
How can I avoid this problem?
I try to use a FormType with a route_name parameter.
I think it would be great to do something to avoid these behaviors :
I have add a new parameter (ids) to the JqueryAutocompleterType, used to add parameters to the Ajax Request. It would be great to also have it here.
Hi,
Today after the daily update i do, my form fields using "genemu_jqueryautocompleter_entity" have changed...
Here is my code :
$builder
->add('motcle', 'genemu_jqueryautocompleter_entity', array
(
'route_name' => 'ajax_mots_cle',
'class' => 'PathToMyEntityFolder\Entity\MotsCle',
'property' => 'titre',
'label' => 'Mots clés libres',
))
;
And a selet field is generated in html...any solution?
I'm using the dev-master version & sf2.1.*
Hello,
I am sorry if it is just a misconfiguration from my side, but I have tried again and again to understand what could be wrong.
I have setup an autoupload file component, but once I have selected the files, I have a straight up "error" alert. Firebug does not show any HTTP request sent but the one for the image cancel.png...
I have set up the File component as described in the doc:
genemu_image:
resource: "@GenemuFormBundle/Controller/ImageController.php"
type: annotation
genemu_upload:
resource: "@GenemuFormBundle/Controller/UploadController.php"
type: annotation
genemu_form:
image:
enabled: true
filters: ['rotate', 'bw', 'negative', 'sepia', 'crop']
file:
enabled: true
cancel_img: '/images/cancel.png'
folder: '/uploads'
uploader: '/uploadify/uploadify.allglyphs.swf'
My form contains only the genemu_jqueryfile field:
$builder->add('auto_download', 'genemu_jqueryfile', array(
'configs' => array(
'auto' => true
)
));
And the view contains (simplified version):
{% block stylesheets %}
{% spaceless %}
{{ parent() }}
{{ form_stylesheet(form) }}
{% endspaceless %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src="{{ asset('js/jquery.uploadify.v2.1.4.min.js') }}"></script>
<script src="{{ asset('js/swfobject.js') }}"></script>
<script src="{{ asset('js/jquery.Jcrop.min.js') }}"></script>
{{ form_javascript(form) }}
{% endblock %}
{{ form_errors(form) }} {{ form_rest(form) }}
<input type="submit" class="btn primary" value="{{ 'update'|trans }}">
</fieldset>
Any help / clarifications would be greatly appreciated
EDIT: I use the 2.0 branch and I should mention that the files seem to be correctly uploaded.
what should I use instead of 'ids' in 2.0 version?
Hi,
I would like my form that uses the autocomplete function of the bundle to be submitted as soon as someone selects a value in the form.
Instead, right now, people have to click (or press enter) twice : one for selecting the value and one for submitting.
Is there any way to do this with this bundle ? (even if I have to modify myself the code of the bundle on my server)
Thanks
Hi,
Thank you mister for you super bundle which I already use !
I was wondering if one could add ajax autoloading for the genemu_jqueryautocompleter widget.
Or at least show me the path to implement it.
Thanks,
Ibiz
Hello,
Some PR have been made quite some time ago now. As I can obvisouly understand that you are not dedicated to this project, it is also hard for us to know whether we should keep working on this Bundle and commit new PR.
It is ok if you need more time, but can you please let us know whether you will be maintaining this Bundle, or should we create another one ?
Thank you for your answer (and thanks again for the job you made! don't take me wrong).
I tried to setup an autocomplete field, which takes its values from a doctrine Entity with the following code:
->add('name', 'genemu_jqueryautocompleter', array(
'label' => 'name',
'class' => 'FooBundle:Bar',
'widget' => 'entity',
'query_builder' => function (EntityRepository $er) use ($founderId) {
return $er->createQueryBuilder('b')
->where('b.founder = :founderId')
->orderBy('b.name', 'ASC')
->setParameter('founderId', $founderId);
},
'property' => 'name',
))
As the field correctly displays the values referenced by the entity, it does not work properly when I enter free text.
For instance, if my entity contains "name1" and "name2" and that I type "NewName", it does not work as the form object will be either contain an invalid value (the last value selected from the list) or will be uninitialized if I have never selected a specific value from the list.
Am I doing something wrong here ? Or is it something else?
EDIT: It seems that playing with the change event would work but then I get an error with my form validation... I would really appreciate help on this topic.
When creating a form that contains a dynamic subform (collection), the jqueryfile element does not work.
Basically, the button is not displayed, but it seems that the data-prototype does not include the necessary code.
Hello,
I have been unable to install the bundle onto SF2.0.8 as it breaks the console, somehow.
When running any command with the console, I always get the error :
[LogicException]
Format png does not supported.
Basically, what I did was:
1- update the deps file and run php bin/vendors install
2- clear the cache with php app/console cache:clear (works fine)
3- update AppKernel.php and autoload.php with the given values in the doc
Then if you run any command in the console (like clearing the cache for instance) you get the error I mentioned earlier.
Any clue ?
By the way, here is my deps file if needed : http://pastie.org/3112210
If I remove the configuration of the bundle in autoload and AppKernel, then the console works again.
Hi, thank you so much for this bundle.
In my localhost installation all works fine, both JQueryAutocompleter and data persist.
My classType is:
class ClientType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
//I put only interesting field. Other ones works properly
$builder->add('City', 'genemu_jqueryautocompleter', array(
'route_name' => 'city_ajaxloader',
'class'=>'MyBundle\Entity\City',
'widget' => 'entity',
'property'=>'city_name',
));
}
I have uploaded on an hosting server all the code I have in my local installation. All works fine, but when I persist my client entity, city entity don't be saved. In my local installation all goes right, but in my remote hosting not. source codes are the same.
I've tried to go to the SymfonyProfiler (both in local that in remote installation) and in "Request POST Parameters" I have noticed that the double quote of the "stringfied" json element is interpreted in different ways:
local:
MyBundle_clienttype %array% { name: 'John', last_name: Smith, ....., Cyty: '{"label":"CROTONE|KR","value":3236}' }
remote:
MyBundle_clienttype %array% { name: 'John', last_name: Smith, ....., City: '{"label":"ORLANDO|FL","value":3236}' }
In the Symfonyprofiler also I have noticed that Symfony does not made the query for retrieving city id in the remote installation:
//In local installation
SELECT t0.id AS id1 FROM City t0 WHERE t0.id = ?
Parameters: ['3236']
and consequently city id does not be saved in the client.city_id column.
Seems that Sympony2 does not see that i've changed the city field.
I'm not sure that is a AjaxAutoloader problem (I'm sure), but I can't find any solution for this.
Do you have any suggestion?
Many thanks!
The type name specified for the service genemu.form.jquery.type.chosen.entity does not match the actual name
&&
Notice: Undefined index: genemu_jquerychosen_country
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('choices', 'genemu_jquerychosen_choice', array(
'disable_search_threshold'=>'0',
'choices' => array(
'foo' => 'Foo',
'bar' => 'Bar')));
}
{% block stylesheets %}
{{ form_stylesheet(form) }}
{% endblock %}
{% block javascripts %}
<script src="{{ asset('bundles/mymain/js/jquery-1.7.2.min.js') }}"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
<script src="{{ asset('bundles/mymain/tiny_mce/tiny_mce.js') }}"></script>
{{ form_javascript(form) }}
{% endblock %}
{{ form_widget(form) }}
doesnt work as expected, data are loaded in select but no css style and an javascript error "$field.chosen is not a function"
thank you
I am not using twig for my projects and I noticed that there is no helper for PHP template engine.
Using for example renderJavascripts() method from php template view is not possible.
Can helper for php views can be addes to bundle code?
Hey! I got one issue. I need a text field that includes something like google suggest. For example I'm using autocompliter with choices
....
->add('title', 'genemu_jqueryautocompleter', array(
'choices' => array(
'blabla' => 'blabla' ,
)
....
If I enter non-existent value then nothing happen. For my case I need to allow non-existent values in this field in order to persist it to database. Can you give me advice how to do that. And i think that it'll be more logical to display an error if I've entered non-existent value in standard case instead of ignoring it.
Select2 is out and has more options/possibility than Chosen. Maybe we can give a shot to this library ?
Tokeninput is broken and needs to be refactored (cf. autocompleter)
The 2.0 branch is missing the select.png image which is needed for the ColorPicker widget to be displayed properly.
each colorpicker set the value in the last defined field.
I fix this temporary in /../vendor/bundles/Genemu/Bundle/FormBundle/Resources/views/Form/jquery_layout.html.twig line 144:
- $field = $('#{{ id }}');
+ var $field = $('#{{ id }}');
HI I am trying to install your bundle but I need some help
the section in the documentation called "Add form_javascript and form_stylesheet to view"
none of these files appear to exist within the bundle. Are they supposed to or am I supposed to go and download them all?
For now I am only trying to use tinymce but I plan on using a lot of the other bits soon.
Thanks.
On the 2.0 branch:
Autocomplete seems to wreck the value which is entered in the input field, if that value is not already in the autocomplete list.
This makes it impossible to use the autocomplete as a list of "suggestions" for the input field.
Hi
I have not looked at why the dependency exists but is there any way to remove this or at the very least disable this part of the bundle.
I am not using doctrine I am using propel.
For now I would be more than happy to just be able to disable the auto complete feature so it does not try to load its dependencies.
Thanks
try to find a fix
cf #107
So I'm not sure what was used for the ratings, if it was a jQuery plugin, but then it seems there's a lot of them.
Could you update the link to where we can download the actual javascript rating lib?
I put uploadify.swf into web/swf/
In my config file, I put :
genemu_form:
image: ~
file:
uploader: /swf/uploadify.swf
I added 'genemu_jqueryimage' in my form model and include all stylesheets ans javascript, when I try to load profile_edit page, I have the uploadify image input, but I can do nothing and I have this error into the console :
GET http://localsf2.dowith.fr/app_dev.php/profile/uploadify.swf?preventswfcaching=1338216405943 404 (Not Found)
So, the browser did'nt try to get uploadify.swl in /web/swf...
I did something wrong ?
Thanks for help.
PHP Warning: Unterminated comment starting line 11 in /opt/www/drivenicely/empty.drivenicely.changl.2288.org/vendor/doctrine-common/lib/Doctrine/Common/Annotations/PhpParser.php on line 64
Warning: Unterminated comment starting line 11 in /opt/www/drivenicely/empty.drivenicely.changl.2288.org/vendor/doctrine-common/lib/Doctrine/Common/Annotations/PhpParser.php on line 64
Item "uploader" for "Array" does not exist in GenemuFormBundle:Form:jquery_layout.html.twig at line 521
in my config.xml i did
genemu_form:
image: ~
and in my form type i did
$builder->add('cover', 'genemu_jqueryimage');
Ie6 doesnt work with inline images.
Looks like some "compatibility" mode need to be added in order to solve this problem (possibly store captcha in session and return it using some unique id)
Hi, it's me again !
I'm using this in my form builder :
<?php
$builder
->add('lieux', 'genemu_jqueryautocompleter', array(
'route_name' => 'lieu_request',
'multiple' => true,
'widget' => 'entity',
'class' => 'Kieski\LieuBundle\Entity\Lieu',
));
With this in my entity :
<?php
/**
* @ORM\ManyToMany(targetEntity="Kieski\LieuBundle\Entity\Lieu")
* @Assert\NotNull(message="error.lieux.blank")
*/
protected $lieux;
Ajax autoloading works great, sumbmission and validation works too, but the problem is that the query to fetch all Kieski\LieuBundle\Entity\Lieu
entites is still used while the page is loading.
I'm maybe misusing your bundle again, but I still can't figure what is this going on,
Ibiz
I'm trying to use your Bundle for jquery datepicker, and I get this error:
jQuery(document).ready(function($) {
var
minDate: new Date(2007, 0, 1),
maxDate: new Date(2017, 11, 31)
}, $.datepicker.regional['ca_ES'] ,{"dateFormat":"yy-mm-dd","showOn":"button"});
Uncaught TypeError: Cannot read property 'regional' of undefined
I have added in the template:
{{ form_stylesheet(form) }}
{{ form_javascript(form) }}
And this is how I add the jquerydate to the form field:
->add('dataPublicacio','genemu_jquerydate')
What's wrong?
I get this error after installation:
Catchable Fatal Error: Argument 1 passed to Symfony\Bridge\Twig\Extension\FormExtension::__construct() must be an array, object given, called in /path/to/symfony/app/cache/dev/appDevDebugProjectContainer.php on line 1339 and defined in /path/to/symfony/vendor/symfony/src/Symfony/Bridge/Twig/Extension/FormExtension.php line 34
Any clues?
It seems that Closure In DateType::getDefaultOptions() is never proccesed (no error although use statement is missing), because it should be applied on 'config' options, not on 'showOn'.
Tinymce is completly ignoring defined options and always uses defaults.
I work with the 2.0 branch.
I have an UnexpectedTypeException with any genemu_jqueryautocompleter from entity :
UnexpectedTypeException: Expected argument of type "array or \Closure", "NULL" given
I try with basic configuration (class and widget parameters), and also with property and query_builder parameters.
->add('organism', 'genemu_jqueryautocompleter', array( 'class' => 'AppliDocEntitiesBundle:DocOrganism', 'widget' => 'entity', 'property' => 'labelLong', 'query_builder' => function (DocOrganismRepository $er) { return $er->searchByLabelLong('FRA'); }, ))
Am I doing something wrong or is there anything to fix ?
I managed to do what I wanted, using the Choices Ajax configuration. I don't see the gain of using Entity Ajax configuration instead of Choices Ajax.
When using the widget single_text for "genemu_jquerydate" following javascript error occurs:
Uncaught ReferenceError: dateText is not defined
Hi, I think that I found a bug or I do something incorrectly ...
According instructions, I put into my form builder this code:
->add('name', 'genemu_jqueryautocompleter', array(
'label' => '{LABEL}',
'route_name' => '{ROUTE}))
Form also uses data_class
(Doctrine entity):
public function getDefaultOptions(array $options)
{
return array(
'data_class' => 'App\MyBundle\Entity\{ENTITY_NAME}',
'validation_groups' => array( '{GROUP_NAME}' ),
) + $options;
}
Validators are in validation.xml file. For this property, as example, I added NotBlank validator.
name
value is not bind when $form->bindRequest($request) is called. $form->isValid() returns FALSE. In $form->getData() name
is NULL. But in request form_name
and its value exists. Probably, it may be as result of text
to hidden
transformation in view and real and submitted field types are different.
PS. Symfony 2.0.9, Doctrine 2.1.5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.