CluesShop.com

Tuesday, 28 October 2014

Drupal 7 form for every one

function agentregistration_menu(){
    $items = array();
    $items['agentregistration'] = array(
         'title' => 'Agent Registration',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('agent_registration'),
        'file' => 'inc/agentregistration.inc',
        'access callback' => 'user_access',
'access arguments' => array('access content'),
       
    );
   
     return $items;
}

Monday, 27 October 2014

data base create in drupal 7

CREATE TABLE IF NOT EXISTS  `fleet_overview` (
 `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
 `data` LONGTEXT COMMENT  'Data',
 `position` INT( 11 ) DEFAULT NULL ,
 `status` INT( 11 ) DEFAULT 1,
PRIMARY KEY (  `Id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =9


CREATE TABLE IF NOT EXISTS  `fleet_virtual` (
 `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
 `mainid`INT(11) NOT NULL,
 `virtualimage` LONGTEXT COMMENT  'virtualimage',
PRIMARY KEY (  `Id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =9


CREATE TABLE IF NOT EXISTS  `fleet_middle_slider` (
 `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
 `mainid`INT(11) NOT NULL,
 `middleimage` INT(11) NOT NULL COMMENT  'middleimage',
 `accomodations` LONGTEXT COMMENT  'accomodations',
PRIMARY KEY (  `Id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =9



CREATE TABLE IF NOT EXISTS  `fleet_gallery` (
 `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
 `mainid` INT( 11 ) NOT NULL ,
 `galleryType` VARCHAR( 256 ) ,
 `galleryData` VARCHAR( 256 ) ,
 `position` INT( 11 ) NULL ,
PRIMARY KEY (  `Id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =9

include css in drupal 7

drupal_add_css(drupal_get_path('module', 'affilationbackend') . '/css/affilationbackend.css');

Add placeholdert to druapl 7 form

  $form['Subscribe_Email'] = array(
        //  '#id' => 'footer-signup',
        '#type' => 'textfield',
        '#prefix' => "<div class='span4'>    
                                   <div class='footer-signup'>
                                    <div class='footer-signup-inner'>
                           Sign-up for Specials & News
                                      <div class='signupInner'>",
        '#required' => TRUE,
        '#attributes' => array ('placeholder' => 'Newsletter Signup'),
    );

Tuesday, 21 October 2014

Validate E-mail Addresses Drupal 7

<?php
$mail = $form_state['values']['submitted_tree']['email_address'];
if (!valid_email_address($mail)) {
  form_set_error('[submitted][email_address]', t('The email address appears to be invalid.'));
}?>

Drupal 7 ajax form validation and submit

Drupal 7 ajax form validation and submit
Ajax is one of the best interactive way to validate and submit Drupal custom form.
Using below steps, we can achieve ajax form validation and submit.

Steps :
1) Declare form elements
2) Call back definitions.

1) Declare form elements.
01    $form['submit'] = array(
02      '#type' => 'submit',
03      '#value' => t('SUBMIT'),
04      '#validate' => array('validate_callback'), // custom form validate.
05      '#ajax' => array(
06        'callback' => 'submit_callback',
07        'effect' => 'fade',
08        'wrapper' => 'specific-wrapper',
09        'event' => 'click',
10        'progress' => array('message' => '', 'type' => 'throbber'),
11      ),
12    );

2) Call back definitions.
1    function submit_callback($form, $form_state) {
2      if (form_get_errors()) {
3        $form_state['rebuild'] = TRUE;
4        return $form;
5      }
6   
7      $response = my_form_submit($form, $form_state); // write your form submit logic here.
8      return $response;
9    }
"validate_callback" is our normal hook_form_validate().
- See more at: http://kali-dasan.blogspot.in/2014/07/drupal-7-ajax-form-validation-and-submit.html#sthash.9wFmbiMI.dpuf

Drupal 7 ajax form validation and submit

Ajax is one of the best interactive way to validate and submit Drupal custom form.
Using below steps, we can achieve ajax form validation and submit.

Steps :
1) Declare form elements
2) Call back definitions.

1) Declare form elements.
01$form['submit'] = array(
02  '#type' => 'submit',
03  '#value' => t('SUBMIT'),
04  '#validate' => array('validate_callback'), // custom form validate.
05  '#ajax' => array(
06    'callback' => 'submit_callback',
07    'effect' => 'fade',
08    'wrapper' => 'specific-wrapper',
09    'event' => 'click',
10    'progress' => array('message' => '', 'type' => 'throbber'),
11  ),
12);

2) Call back definitions.
1function submit_callback($form, $form_state) {
2  if (form_get_errors()) {
3    $form_state['rebuild'] = TRUE;
4    return $form;
5  }
6 
7  $response = my_form_submit($form, $form_state); // write your form submit logic here.
8  return $response;
9}
"validate_callback" is our normal hook_form_validate(). 
- See more at: http://kali-dasan.blogspot.in/2014/07/drupal-7-ajax-form-validation-and-submit.html#sthash.9wFmbiMI.dpuf

Drupal 7 ajax form validation and submit

Ajax is one of the best interactive way to validate and submit Drupal custom form.
Using below steps, we can achieve ajax form validation and submit.

Steps :
1) Declare form elements
2) Call back definitions.

1) Declare form elements.
01$form['submit'] = array(
02  '#type' => 'submit',
03  '#value' => t('SUBMIT'),
04  '#validate' => array('validate_callback'), // custom form validate.
05  '#ajax' => array(
06    'callback' => 'submit_callback',
07    'effect' => 'fade',
08    'wrapper' => 'specific-wrapper',
09    'event' => 'click',
10    'progress' => array('message' => '', 'type' => 'throbber'),
11  ),
12);

2) Call back definitions.
1function submit_callback($form, $form_state) {
2  if (form_get_errors()) {
3    $form_state['rebuild'] = TRUE;
4    return $form;
5  }
6 
7  $response = my_form_submit($form, $form_state); // write your form submit logic here.
8  return $response;
9}
"validate_callback" is our normal hook_form_validate(). 
- See more at: http://kali-dasan.blogspot.in/2014/07/drupal-7-ajax-form-validation-and-submit.html#sthash.9wFmbiMI.dpuf

Drupal 7 ajax form validation and submit

Ajax is one of the best interactive way to validate and submit Drupal custom form.
Using below steps, we can achieve ajax form validation and submit.

Steps :
1) Declare form elements
2) Call back definitions.

1) Declare form elements.
01$form['submit'] = array(
02  '#type' => 'submit',
03  '#value' => t('SUBMIT'),
04  '#validate' => array('validate_callback'), // custom form validate.
05  '#ajax' => array(
06    'callback' => 'submit_callback',
07    'effect' => 'fade',
08    'wrapper' => 'specific-wrapper',
09    'event' => 'click',
10    'progress' => array('message' => '', 'type' => 'throbber'),
11  ),
12);

2) Call back definitions.
1function submit_callback($form, $form_state) {
2  if (form_get_errors()) {
3    $form_state['rebuild'] = TRUE;
4    return $form;
5  }
6 
7  $response = my_form_submit($form, $form_state); // write your form submit logic here.
8  return $response;
9}
"validate_callback" is our normal hook_form_validate(). 
- See more at: http://kali-dasan.blogspot.in/2014/07/drupal-7-ajax-form-validation-and-submit.html#sthash.9wFmbiMI.dpuf

Drupal 7 ajax form validation and submit

Ajax is one of the best interactive way to validate and submit Drupal custom form.
Using below steps, we can achieve ajax form validation and submit.

Steps :
1) Declare form elements
2) Call back definitions.

1) Declare form elements.
01$form['submit'] = array(
02  '#type' => 'submit',
03  '#value' => t('SUBMIT'),
04  '#validate' => array('validate_callback'), // custom form validate.
05  '#ajax' => array(
06    'callback' => 'submit_callback',
07    'effect' => 'fade',
08    'wrapper' => 'specific-wrapper',
09    'event' => 'click',
10    'progress' => array('message' => '', 'type' => 'throbber'),
11  ),
12);

2) Call back definitions.
1function submit_callback($form, $form_state) {
2  if (form_get_errors()) {
3    $form_state['rebuild'] = TRUE;
4    return $form;
5  }
6 
7  $response = my_form_submit($form, $form_state); // write your form submit logic here.
8  return $response;
9}
"validate_callback" is our normal hook_form_validate(). 
- See more at: http://kali-dasan.blogspot.in/2014/07/drupal-7-ajax-form-validation-and-submit.html#sthash.9wFmbiMI.dpuf

Wednesday, 2 April 2014

media print css

<style type="text/css" media="print">
          @media print{
             @page {
  size: auto;   /* auto is the initial value */
  margin: 10%;
}
      @page :first {
  margin-left: 2mm;
}
   body * { visibility: hidden; }
  .printconfirmationdiv * { visibility: visible; }
  .printconfirmationdiv { position: absolute; top:40px;}
  .confirmationContainerright * { display:none; }
  .confirmationContainerleft{width:100% !important; }
  .bookingTicketDetails{width:80% !important;}
  .printcss{width:80% !important;}
  .printcssfee{width:80% !important;}
 
   a{display: none ; }
    </style>

<a href="#" onclick="window.print();">