This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

How to submit using hook_alter_form for a node

I've been searching everywhere and cannot find any information on how to submit & pick up the data using the form_alter hook.

Modify form required values using jQuery

I am working on an ecommerce checkout form. On the Shipping/Billing page, I have a "Same as billing" checkbox.

What I'd like to do is if the checkbox is not set, change the form so all of the shipping fields are required and have the red asterix, validate, etc.

This is what I have so far

1) My form element in a form function:

 $form['address']['shippingSame'] = array('#id' => 'sameship-box', '#attributes' => array('onclick' => 'mod_class_fields(this.value);'), '#type' => 'checkbox', '#title' => t('Same as billing address.'), '#weight'=>-40);

2) The Javascript (borrowed from here http://www.ubercart.org/drupal_module_and_jquery_guides/code_explanation)
I am not strong in javascript at all - how should I be communicating with FAPI through jQuery?

<?php

drupal_add_js('$(document).ready(function(){
// Ready code here.
if ($("#class-box").val() > 0)
mod_class_fields($("#sameship-box").val());
} );

//mod fields
function mod_class_fields(class_id) {
if (class_id == 1) {
//$("#billing-fields").hide("slow").empty();

$form['address']['shipping']['firstname']['#required'] = TRUE;
$form['address']['shipping']['lastname']['#required'] = TRUE;
//etc
} else {

$form['address']['shipping']['firstname']['#required'] = FALSE;
$form['address']['shipping']['lastname']['#required'] = FALSE;
//etc

Modify form required values using jQuery

I am working on an ecommerce checkout form. On the Shipping/Billing page, I have a "Same as billing" checkbox.

What I'd like to do is if the checkbox is not set, change the form so all of the shipping fields are required and have the red asterix, validate, etc.

This is what I have so far

1) My form element in a form function:

 $form['address']['shippingSame'] = array('#id' => 'sameship-box', '#attributes' => array('onclick' => 'mod_class_fields(this.value);'), '#type' => 'checkbox', '#title' => t('Same as billing address.'), '#weight'=>-40);

2) The Javascript (borrowed from here http://www.ubercart.org/drupal_module_and_jquery_guides/code_explanation)
I am not strong in javascript at all - how should I be communicating with FAPI through jQuery?

<?php

drupal_add_js('$(document).ready(function(){
// Ready code here.
if ($("#class-box").val() > 0)
mod_class_fields($("#sameship-box").val());
} );

//mod fields
function mod_class_fields(class_id) {
if (class_id == 1) {
//$("#billing-fields").hide("slow").empty();

$form['address']['shipping']['firstname']['#required'] = TRUE;
$form['address']['shipping']['lastname']['#required'] = TRUE;
//etc
} else {

$form['address']['shipping']['firstname']['#required'] = FALSE;
$form['address']['shipping']['lastname']['#required'] = FALSE;
//etc

Help with drupal_retrieve_form / Form API

I want to retrieve the array version of a node form using drupal_retrieve_form. I wrote this quick test function to see if it was going to work:

Events filtered by group in menu

Hi.

I have installed Organic Groups and Events on my site. I want to add a menu item so that people will be able to access the group calendar from any page, but I'm not sure how to do that. I can add menu items going to specific calendars, but I want the menu to just show the calendars for the groups the user is part of. Right now it shows all menu links, and when you click on calendar for a group you don't belong to, it just tells you you don't have permission.

Also, when viewing the calendar, is there a way to filter by group?

Thanks

Category on User Profile Form

Hello:

I'm at a loss as to how to get a custom form for a user profile to appear under its own category in the Edit tab for My Account. I've developed a module that alters the user registration form and saves custom data. When the user goes to edit their account (under My Account) the custom form is displayed under the 'Account Settings' category. How do I get the custom form (developed in a module not using the Profiles module) to only be displayed when a user clicks on a category.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions