Joomla Contact Form - default_form.php file modification - checkbox

I am adding custom checkboxes and radio buttons to my Joomla website.
One of the requirements for replacing the browsers checkboxes and radio buttons, is the Input tags must be above the label tags. Why is a mystery to me, maybe someone can explain this also.
Anyhow, I have attempted to modify the Joomla \components\com_contact\views\contact\tmpl\default_form.php file by simply reversing the order for the send email copy checkbox.
When I review the modified contact page in a browser and inspect, the order has not changed ...... nothing at all.
What am I doing wrong?
The changes are like whats show below....
<dt><?php echo $this->form->getInput('contact_email_copy'); ?></dt>
<dd><?php echo this->form->getLabel('contact_email_copy'); ?></dd>

Related

Joomla contact form: How to fix/edit bugged tooltip?

For the Joomla contact form (using Joomla 3.3.3), you have your required fields and a tooltip that shows if you mouse over the field name. Fx. the field "Name" the tooltip I suppose would show "Your name"
But instead it shows this: "< strong >Name< /strong >< br/ >Your name"?
How to remove the "< strong >Name< /strong > "?
Have tried looking around a bit but haven't really found a solution to this yet. Only how to remove/hide the tooltips, but not how to fix it removing those code strings.
Screenshot of my contact form:
https://www.dropbox.com/s/k4dxsst0u91gcan/Contact%20tooltip%20issue.png?dl=0
Okay figured that the problem is coming from my template.
Tried switching over to the joomla protostart template and test it there, and the tooltip work fine.
So now I need to figure out why it isn't working on the template I'm currently using.
It was a jquery conflict with joomla updates.
Fixed it by editing the var.php in my template with the following changes:
From, (line 7):
JHTML::_('behavior.framework', true);
// disabled sins joomla 3
//JHTML::_( 'behavior.mootools' );
To:
JHtml::_('bootstrap.framework'); // JOOMLA 3.X (LOADS BOOTSTRAP)
JHtml::_('behavior.framework', true);
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/jquery_no_conflict.js', 'text/javascript');
// disabled sins joomla 3
//JHTML::_( 'behavior.mootools' );
And removed this on line 28.
// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');

TinyMCE: cake php plugin [ cannot submit form ]

I use https://github.com/CakeDC/TinyMCE to download plugin and did follow all the step to integrate on my cakePHP project. so right now, all the textarea was successfully changed to tinyMCE editor
But when click "SUBMIT" to submit my form, page cannot submit and post data. Without loading editor my form can submit and post data.
Is any jquery problem ? please advise me.
thank you.
Bootsrab.php
CakePlugin::load('TinyMCE');
Configure::write('TinyMCE.editorOptions', array('width' => '500px','height'=>'250px' ));
Controller:
public $helpers=array('Html','Form','TinyMCE.TinyMCE');
View:
$this->TinyMCE->editor(array('theme' => 'advanced', 'mode' => 'textareas'));
echo $this->Form->input('user_requirements',array('required'=>true) );
Layout : default
loding js file:
echo $this->Html->script(array('ddsmoothmenu','jquery-1.7.1.min','jquery-ui-1.8.17.custom.min'));
You've set the field to be required, so the problem you are experiencing is probably the browser based form validation.
The problem is that the validation applies before TinyMCE injects the contents into the textarea, and so the validation will always fail as the textarea is empty. This is a very long known "bug" btw:
http://www.tinymce.com/develop/bugtracker_view.php?id=4768
http://www.tinymce.com/develop/bugtracker_view.php?id=5671
In Firefox you might notice a validation bubble that appears "behind" the browser in the bottom left corner of the screen, and in Chrome for example it would throw the following error: "An invalid form control with name='...' is not focusable".
The quick and dirty fix would be to set required to false. In order to keep the required class on the generated container div you would have to set this manually using the div option:
'div' => array('class' => 'input text required')
It's also possible to disable browser validation completely by defining the novalidate attribute on the form:
$this->Form->create('ModelName', array('novalidate' => true));
or using the formnovalidate attribute on the submit button:
$this->Form->submit('Submit', array('formnovalidate' => true));
Theoretically it would also be possible to listen to the invalid event and display custom validation bubbles, but the problem here is that the browser behavior is not consistent, ie in Chrome it's not possible to validate invisible (using display or visibility) fields. Also the content would still be missing in the textarea field.
What seems to work is using opacity to hide the field, that way one could position the textarea under the editor, and the validation bubble would be displayed correctly. However that would also require to inject the editor contents in the textarea manually when pressing Enter and when clicking the submit button (or probably even simpler using proper editor change events). I'll see if I can come up with an example for this later on.
Update: I've implemented a fix/workaround in form of a TinyMCE 4.x plugin, as this was bugging me in some of my own applications too, see https://github.com/ndm2/tinymce-validatable

Saving a Disabled field

In my edit.ctp I have a select box which I don't need the user to change. So I put array(disabled=>true). But this field is not coming when
pr($this->data); and showing an error while saving.
What options are there to solve this issue.
If you know the value of the data you can edit it at the controller.
$this->request->data['ModelName']['fieldName'] = value;
UPDATE
Edit it like
echo $this->Form->input('patient_id',array('type'=>'select', 'readonly' => 'readonly'));
You could make the field readonly so that user cant change it , or use some hidden field to post the data that you want, or you could use some css, like visibility:hidden, so that user dont see it but it'll be posted.
echo this->Form->input('patient_id',array('type'=>'hidden'));
You can use some other name for the input and check in controller, or you could completely remove the select element from the view*strong text* (since, its not needed as user dont need to change it)

Cakephp - keep selected value for dropdownlist after submit

How can I keep the selected value for a dropdownlist after form submission in Cakephp?
If more info (or some code) is needed just tell me please.
UPDATE
Here is part of the code in my view:
echo $this->Form->create('Chart');
echo $this->Form->input('username',
array('label'=>('Usernames List'),
'default'=>('Select username'),
'options'=>$usernames, 'selected'=>false));
echo $this->Form->end('Create Chart');
So, when I press 'Create Chart', the dropdownlist doesn't keep the username that I selected, but it goes back to the first one.
The Form helper uses the data stored in $this->data to prepopulate fields. Make sure that when you are submitting the form, the view that is rendered after has the appropriate model/key data stored in $this->data in order for the Form helper to correctly fill in the appropriate values.
Can we see your controller action possibly? That may help draw a more accurate conclusion.
you should never use the view to set defaults or values (especially selected/value is wrong as it - like your code - destroys the idea of persistent forms).
use the controller instead
#see http://www.dereuromark.de/2010/06/23/working-with-forms/ (Default Values)
add value in dropdown like this:
<?php echo $this->form->select('Schedule.showsid', array('0'=>'title', '1'=>'description'));?>

confirm page with form result in cakephp

hi i am making a form with a confirm page where I would like to display what was input from the form and give the user a chance to check it before sending it in.
I have successfully done this by saving the form elements in the session:
$this->Session->write('Visitor.confirm', $this->data);
and get it by:
<? $fields = $this->Session->read('Visitor.confirm')?>
<?php echo $fields['Visitor']['v_firstname']; ?>
<?php echo $this->Form->hidden('v_firstname', array('value'=> $fields['Visitor']['v_firstname']));?>
....for each field. but i cannot get the fields to send as a new form? there must be a simpler way!
many thx
Is the 'confirm' button a submit button within your form with all your hidden fields? Or do you have it as a good old fashioned link, and hoping that it submits your hidden form data?
Is there a reason why you would not grab the values out of the session on the page after confirmation, as opposed to resubmitting everything in a hidden form?
you don't have to post the form again. When user clicks confirm, and a confirm() action is called, you just have to save what's in $this->Session->read('Visitor.confirm');

Resources