How get Form data in admin magento - magento

I have added a button on admin form in magento,when i click on it i did not get form data,i want functionality like save button.
$this->_addButton('owner', array(
'label' => Mage::helper('adminhtml')->__('Change Owner'),
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/owner/id/'.$id) . '\')',
'class' => 'save',
),1,3);

First of all your requirement is not clear.Where are you checking the submitted data? If you want to submit the admin form data and receive it in the controller file than you placed the button in the wrong place.It should not be in the Form.php

Related

How create and ACF form with preview button?

I hava a front end form i want to have a preview button for the form. problem is acf form generates the post id after submitting the form. So can't add a preview link
get_preview_post_link this can be used to get the preview link but it requires a iD to passed..
How can i add a preview button? may be ajax save the post as draft? and allow option to publish in the new page?
<?php
acf_form(array(
'post_id' => 'new_post',
'submit_value' => __("Create", 'acf'),
'return' => '%post_url%',
'updated_message' => __('added Successfully', 'acf'),
'post_title' => true,
'post_content' => false,
'new_post' => array(
'post_type' => 'l',
'post_status' => 'publish',
),
));
?>
Please help thanks

magento admin confirmation popup on invoice creation

I am trying to add a confirmation popup on to a existing button in the Magento Admin. When you press capture it shout ask if you are sure. I have found the code of the button in the adminhtml folder and dont know further. I have found out that you can use the onclick parameter to start a js function but that parameter is already set by magento.
Here is the code of the button
if ($this->_isAllowedAction('capture') && $this->getInvoice()->canCapture()) {
$this->_addButton('capture', array(
'label' => Mage::helper('sales')->__('Capture'),
'class' => 'save',
'onclick' => 'setLocation(\''.$this->getCaptureUrl().'\')'
)
);
}
'onclick' => "confirmSetLocation('Are you sure you want to do this?', '{$this->getUrl('*/*/delete')}')",
You have to replace 'onclick' => 'setLocation(\''.$this->getCaptureUrl().'\')'
with 'onclick' => "confirmSetLocation('{$message}', '{$this->getCaptureUrl()}')",

Drupal form ajax submit not working

The drupal form that i submit has ajax property defined
'#submit' => array(),
'#ajax' => array(
'callback' => 'form_submit',
'wrapper' => 'problem-wrapper',
'method' => 'replace',
'effect' => 'fade',
$form['#validate'][] = 'problem_form_validate';
but it does the validation only on second click of the submit button. The first time i submit it shows the please wait...
throbber but nothing happens. The second time I click the button it works. What could be the possible reason. This is happening on a specific environment. on some other environment it is not and issue.
What could possibly be in the settings of an environment that forces the validate function to be called only on the second submit.
Thanks,

CakePHP Observe field for validation check(already exists)

i have already user observe field in cakephp 1.3 Now i want to do the same thing in cakephp 2.0
I have one form.there is a one field named email. When user insert email. onblur there is a popup one message that displays "email already exists" or "right"
for that i have write below code in my projects. the below code is my add file code
<?php $options = array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exist');
echo $this->ajax->observeField('UserEmailId',array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exists')); ?>
In my controller i have created one function like
public function is_exist($id = null)
{
$result = "yes";
$this->set('existdata',$result);
}
i have also created is_exists.ctp fiel in view/uers.
i dont know why its not working.
i did the same thing in Cakephp 1.3 and its working file but not in cakephp 2.0
can anyone tell me how i implement this ?
thanks in advance
because ajax helper is not supported in cakephp 2.
you need to learn how to implement it using the js helper
check this link : js helper

Place an image for submit button in Zend form

I have a form made by Zend Framework that needs a submit button. I want to place an image instead of the default button. The code I have is this:
$submit = new Zend_Form_Element_Submit( 'submit');
However, I can not add an image for the submit button here. If I create the form with the following code, it works:
$this->addElement('image', 'submit', array(
'ignore' => true,
'label'=>'Submit',
'src' => ('/media/css/image/submit.png'),
));
How can I add image instead of the default submit button in the first approach of form creation?
$submit = new Zend_Form_Element_Image('submit', array(
'ignore' => true,
'label' => 'Submit',
'src' => '/media/css/image/submit.png'
));

Resources