Hi I was wondering if somebody can point me in the right direction on how to accomplish the following in a custom joomla module in the module configuration form: http://blog.cbolson.com/adding-form-fields-via-ajax-with-mootools/
So far I use a textarea to supply a list of geo data (lat, lng and label text) in the format
lat1,lng1|label1\r\n
lat2,lng2|label2\r\n
lat3,lng3|label3\r\n
...
from the module configuration. This data is displayed on a google map.
It would be nice to have a more comfortable way of adding the data like in the example on blog.cbolson.com.
Create fields type as array say
<div class="test">
<input type="text" name="data[]" />
</div>
and via jquery clone you can replicate that div
and since its an array you can get all entered fields this is logic you can try and
regarding Joomla module Development you can refer Joomla DOCS http://docs.joomla.org/J2.5:Creating_a_simple_module/Developing_a_Basic_Module
You need to create custom form field type. Visit: http://docs.joomla.org/Creating_a_custom_form_field_type
Using a custom form field type, you can achieve what you want.
Well in that case first of all let me say that there are no from field type for button. So you have to perform the action with other event. may be with a radio button change event.
Next is as said by Mr Rahul, you have to create your own custom form field which should have a field path (addfieldpath attribute) that you can learn from here.
And then add a custom.js file to your custom file that is given to the addfieldpath attribute and perform the ajax action there as per your requirement.
Related
I'm asking you for a little advice on creating a specific form in Symfony3.
I need to create a form that upload's an unspecified number of files, which every file has a description text input that belongs to that file.
That's the doc you're looking for https://symfony.com/doc/current/reference/forms/types/collection.html
Come back for more details later :)
I just managed to add a custom field in registration form thanks to an answer here:
Adding custom field in default joomla 3.1.1 registration form and I'm able to add user information after adding the correct field in the mysql talble.
But now I would like to do more: i've a radio field type, and I would like that if user checks the right option a text field appears, or either, if the not correct one is chosen, the textbox disappear. Becouse I already have the radio and text fields.
Like: U drink beer?
yes--> if checked shows a textbox like: "Say us wich one you prefer!"
no --> No textbox appears.
Now I've the radio field and the text field, but the text field have to appear only with the "yes" option.
Joomla has been installed 1 hour ago, i added only language plugin. Nothing else has been done.
Thanks, and really sorry for my bad english.
If you want to add, or remove, or show, or hide... html content dynamically You must use Javascript.
Try to learn more about jQuery, this is a pretty easy syntax who give you You possibility to handle you html content.
link to jQuery javascript framework
I am working on a symfony 1.4 project and am trying to add a custom field in a backend form. At the moment, my module has a batch history with editing and deleting options for each row and a form that allows the user to filter through it. I would like to add a custom creation form and I am struggling to do that.
Going on the /*model_name*/new/ page does show me a form: this is the form I would like to make changes to.
I would like to display a dropdown list of elements from another table (and model) on this page. How can I do that knowing that the current module's widgetSchema doesn't have that relation?
Should I edit generator.yml? When I try adding a title: to new: , it doesn't seem to affect the /new/ page (even after cache:clear).
It would be easier if you create that relation in your schema.yml. Your generated form will be able to render the widget you want.
Otherwise, what you need to do is edit the *model_name*Form class by adding the widget and validator you want (sfWidgetFormDoctrineChoice and sfValidatorDoctrineChoice in your case)
The generator.yml uses the form *model_name*Form class by default, but I suggest you copy this class in a lib folder you create in your module, and edit this one instead. Then, you edit your generator.yml to use this new form, this is how you do it
Also, make sure there is not much rows in the table of your relation. Else, symfony will try to generate a html select tag with a lot of options and you will need to kill your php and even webserver processes.
Yes, you need to edit generator.yml, but in the form line:
# apps/backend/modules/whatever/config/generator.yml
config:
...
form:
display:
Whatever...
Here you have some examples. Taken from the official documentation:
http://symfony.com/legacy/doc/jobeet/1_4/en/12?orm=Doctrine#chapter_12_form_views_configuration
This way, the form that the generator uses will be the one you specify. And maybe you don't need to modify something else.
Hi I want to add an autocomplete input field in limesurvey but don't know hot accomplish this task. Any one know where to add code for add custom input field?
in autocomplete.js
In this file the code that call a php function on the base of keyup in input field.
in checkInDb.php
In this file the code check term that come from **autocomplete.js** and search in database then send response back to js file
Where to add this code?
In the LimeSurvey documentation it explains very well how to modify the surveys with Javascript.
You don't explain too much, but I think you can find the solution here.
I am struggling to find out if I can do this but I have a cakephp form with many input fields and when submitted I write them to a text file I can add fields in dynamically here by clicking a button but:
My question is if I have an admin page how do I get that to dynamically add fields to the page and make them stay there forever not just for that session?
Really stuck figuring out how to do this any guidance would be much appreciated.
Thanks in advance.
Make them persistent. You need to store the form and the fields it has: "Form hasMany FormField". The fields should describe a type so that the FormHelper will render the correct inputs.
When you want to display the form read that information from the db again and render the form according to your stored information.
I am guessing you already have a javascript function that dynamically adds the field to your admin page. Is that correct?
I don't use CakePHP, but a general workaround I use is to use the javascript function to at the same time update a table in the database that stores the form layout.
Here are some Jquery Form builder plugins that you can use to achieve the goal.
http://www.berthou.com/us/2009/09/05/dynamic-forms-builder-with-jquery/
https://github.com/botskonet/jquery.formbuilder
http://code.google.com/p/jquery-form-builder-plugin/
http://www.elizaibeth.com/2010/11/23/dynamic-jquery-form-builders/
Here is an excellent link of PHP FormBuilder class with tutorial, that you can use as a vendor library into CakePHP.