-
-
Save wizonesolutions/2657961 to your computer and use it in GitHub Desktop.
Revisions
-
rocketeerbkw created this gist
Jan 10, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ <?php function stripe_test_menu() { $items = array(); $items['stripe-test'] = array( 'title' => t('Stripe Test'), 'page callback' => 'drupal_get_form', 'page arguments' => array('stripe_test_form'), 'access callback' => TRUE, ); return $items; } function stripe_test_form($form, &$form_state) { $js = <<<EJS jQuery(function() { jQuery('#edit-remove-names').click(function() { var check = jQuery(this); check.attr('disabled', 'disabled'); jQuery(':text').removeAttr('name'); }) }) EJS; drupal_add_js($js, 'inline'); $form['card-number'] = array( '#type' => 'textfield', '#title' => t('Credit Card Number'), ); $form['card-exp'] = array( '#type' => 'fieldset', '#title' => t('Card Expiration'), ); $form['card-exp']['month'] = array( '#type' => 'textfield', '#title' => t('Month'), ); $form['card-exp']['year'] = array( '#type' => 'textfield', '#title' => t('Year'), ); $form['remove-names'] = array( '#type' => 'checkbox', '#title' => 'Remove name attributes', ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); return $form; } function stripe_test_form_submit($form, &$form_state) { drupal_set_message(print_r($form_state['values'], true)); }