Hi Friends<br><br>Am preparing the hotel search ,<br><br>I did like when select the radio1 then form1 will display if selected the radio2 then form 2 will display,<br><br><br>Here is the code <br><br>module and js code<br>
<br><br><span style="color: rgb(255, 0, 0);">module code below<br><br><?php<br><br>$modpath = drupal_get_path('module','reservation');<br>drupal_add_js($modpath . '/reservation.js','module');<br>
<br>function reservation_menu() {<br><br> //array <br> $content[] ="";<br> <br> $content[] = array(<br> 'title' => t('Reservation'),<br> 'path' => 'node/reservation',<br>
'callback' => 'reservation_page',<br> 'access' => user_access('access content') <br> );<br> return $content;<br>}<br><br> <br> /**<br> * called when user goes to <a href="http://example.com/?q=formexample">example.com/?q=formexample</a><br>
*/<br>function reservation_page() {<br> <br> $output = t('Search By');<br> <br> if(isset($_REQUEST['hdnSubmit'])==0){<br> echo "HDN value is 0";<br> //return the HTML generated form the $form data structure.<br>
$output .= drupal_get_form( 'reservation_form');<br> $output .= drupal_get_form( 'address_form');<br> //$output .= drupal_get_form( 'formAddress');<br> }<br>
else{<br> echo "HDN value is 1";<br> $output .= drupal_get_form('formAddress');<br> $output .= drupal_get_form('address_form');<br> <br> <br>
}<br> return $output;<br><br>}<br><br>function reservation_form(){<br> <br> <br> <br> $form['city'] = array(<br> '#id' =>'testcity',<br> '#title' => t('Where'),<br>
'#type' => 'radios',<br> '#description' => t(''),<br> '#options' => array(t('City'),t('Address')),<br> '#default_value' => variable_get('city', 0),<br>
'#required' => TRUE,<br> '#attributes' => array('onclick' => "javascript:callform(this.value)"),<br> );<br> <br> <br> $form['txtWhere'] = array(<br> '#title' => t('Where'),<br>
'#type' => 'textfield',<br> '#description' => t(''),<br> '#required' => TRUE,<br> );<br> <br> $form['txtChkIn'] = array(<br> '#title' => t('Check-In'),<br>
'#type' => 'textfield',<br> '#description' => t(''),<br> '#attributes' => array('class' => 'jscalendar'),<br> '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',<br>
'#jscalendar_showsTime' => 'true',<br><br> );<br> <br> $form['txtChkOut'] = array(<br> '#title' => t('Check-Out'),<br> '#type' => 'textfield',<br>
'#description' => t(''),<br> '#attributes' => array('class' => 'jscalendar'),<br> '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',<br> '#jscalendar_showsTime' => 'true',<br>
);<br> <br> $form['guest'] = array(<br> '#type' => 'select',<br> '#title' => t('Guests'),<br> '#options' => array(<br> 1 => '1',<br>
2 => '2',<br> 3 => '3',<br> 4 => '4',<br> 5 => '5',<br> ),<br> '#default_value' => '1',<br> '#description' => t(''),<br>
'#required' => TRUE<br> );<br> <br> $form['rooms'] = array(<br> '#type' => 'select',<br> '#title' => t('Rooms'),<br> '#options' => array(<br>
1 => '1',<br> 2 => '2',<br> 3 => '3',<br> 4 => '4',<br> 5 => '5',<br> ),<br> '#default_value' => '1',<br>
'#description' => t(''),<br> '#required' => TRUE<br> );<br> <br> $form['submit'] = array(<br> '#type' => 'submit',<br> '#value' => t('submit')<br>
);<br> <br> <br> return $form;<br>}<br><br>function address_form(){<br> echo "<div id='divform1' style='display:none;'>Form 1</div>";<br> print "<div id='divform2' style='display:none;'>".drupal_get_form('formAddress')."</div>";<br>
<br>}<br><br><br>function formAddress(){<br> <br> <br> <br> $form['address'] = array(<br> '#id' =>'testcity',<br> '#title' => t('Where'),<br> '#type' => 'radios',<br>
'#description' => t(''),<br> '#options' => array(t('City'),t('Address')),<br> '#default_value' => variable_get('address', 1),<br> '#required' => TRUE,<br>
'#attributes' => array('onclick' => "javascript:callform(this.value)"),<br> );<br> <br> <br> $form['txtAddress'] = array(<br> '#title' => t('Address'),<br>
'#type' => 'textfield',<br> '#description' => t(''),<br> '#required' => TRUE,<br> );<br> <br> $form['txtCity'] = array(<br> '#title' => t('City'),<br>
'#type' => 'textfield',<br> '#description' => t(''),<br> '#required' => TRUE,<br> );<br> <br> $form['txtPostalcode'] = array(<br> '#title' => t('Postal Code'),<br>
'#type' => 'textfield',<br> '#description' => t(''),<br> );<br> <br> $form['txtNickname'] = array(<br> '#title' => t('Nickname'),<br>
'#type' => 'textfield',<br> '#description' => t(''),<br> );<br> <br> $form['txtChkIn'] = array(<br> '#title' => t('Check-In'),<br> '#type' => 'textfield',<br>
'#description' => t(''),<br> '#attributes' => array('class' => 'jscalendar'),<br> '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',<br> '#jscalendar_showsTime' => 'true',<br>
<br> );<br> <br> $form['txtChkOut'] = array(<br> '#title' => t('Check-Out'),<br> '#type' => 'textfield',<br> '#description' => t(''),<br>
'#attributes' => array('class' => 'jscalendar'),<br> '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',<br> '#jscalendar_showsTime' => 'true',<br>
);<br> <br> $form['guest'] = array(<br> '#type' => 'select',<br> '#title' => t('Guests'),<br> '#options' => array(<br> 1 => '1',<br>
2 => '2',<br> 3 => '3',<br> 4 => '4',<br> 5 => '5',<br> ),<br> '#default_value' => '1',<br> '#description' => t(''),<br>
'#required' => TRUE<br> );<br> <br> $form['rooms'] = array(<br> '#type' => 'select',<br> '#title' => t('Rooms'),<br> '#options' => array(<br>
1 => '1',<br> 2 => '2',<br> 3 => '3',<br> 4 => '4',<br> 5 => '5',<br> ),<br> '#default_value' => '1',<br>
'#description' => t(''),<br> '#required' => TRUE<br> );<br> <br> $form['submit'] = array(<br> '#type' => 'submit',<br> '#value' => t('submit')<br>
);<br> $form['hdnSubmit'] = array(<br> '#type' => 'hidden',<br> '#value' => '0'<br> );<br> <br> return $form;<br><br>}<br><br><br>JS code below<br>
<br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);">// JavaScript Document</span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);">function callform(str){</span><br style="color: rgb(102, 51, 255);">
<span style="color: rgb(102, 51, 255);"> if(str==0){ </span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> document.getElementById('divform1').style.display = 'none';</span><br style="color: rgb(102, 51, 255);">
<span style="color: rgb(102, 51, 255);"> document.getElementById('divform2').style.display = 'none';</span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> document.getElementById('reservation-form').style.display = 'block';</span><br style="color: rgb(102, 51, 255);">
<span style="color: rgb(102, 51, 255);"> </span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> </span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> }</span><br style="color: rgb(102, 51, 255);">
<span style="color: rgb(102, 51, 255);"> else{</span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> </span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> document.getElementById('divform1').style.display = 'none';</span><br style="color: rgb(102, 51, 255);">
<span style="color: rgb(102, 51, 255);"> document.getElementById('divform2').style.display = 'block';</span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> document.getElementById('reservation-form').style.display = 'none';</span><br style="color: rgb(102, 51, 255);">
<span style="color: rgb(102, 51, 255);"> document.getElementById('formAddress').style.display = 'block';</span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);"> }</span><br style="color: rgb(102, 51, 255);">
<span style="color: rgb(102, 51, 255);"> </span><br style="color: rgb(102, 51, 255);"><span style="color: rgb(102, 51, 255);">}</span><br></span><br><br>Here my problem is, <br><br>When i select the city option then city search form will displayed inside theme,<br>
<br>But i click the address option then formAddress form will displaying above of the theme,<br><br>Any idea how to bring inside theme,<br><br clear="all"><br>-- <br>உங்கள் நண்பன் <br>பரணி குமார் <br><br>Regards<br>B.S.Bharanikumar<br>
<br>POST YOUR OPINION <br><a href="http://bharanikumariyer.hyperphp.com/">http://bharanikumariyer.hyperphp.com/</a><br>