I am doing a networking site
for some one that is targeting college students. It is important that they have
a campus associated with their account. I need a little advice as to how best
to approach this.
I have a database table of
campuses that includes a state field. My first take was to add some JavaScript
in the registration form. Users select a state from a select list, which uses
I used something like this:
function
campus_validate($form, &$form_state){
if($form_state['values']['campus']==""){
drupal_set_message(t('Please select a state and campus'));
return false;
}
return true;
}
function
user_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'user_register') {
$form['Personal']['campus'] = array(
'#type' => 'hidden',
'#default_value' => "",
'#required' => TRUE
);
//
the following are not correct, but the idea is I need to validate the extra
fields I am adding. I can muddle through these.
$form['Personal']['campus']['#element_validate'] = array('campus_validate');
// $form['profile_sex']['#element_validate'] = array('sex_validate');
}
}
So I think you can see where
I am going with this although it isn’t complete.
The next thing I want to do,
is I prefer to add a tab for editing the users’ campus. I prefer this to
adding to the user/edit form. Once again, I will need to have a state select
that will use
If the whole thing should be
tossed, and go with multi-step submissions, please point me the right way on
that.
Thank you so much.
Kindest Regards,
Good News Design
Interactive Web sites for
business
mailto:dayton@goodnewsdesign.com
Phone: 616-399-5617
Cell: 616-405-6360