Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_draw_pull_down_menu and disallowing first choice


vipes

Recommended Posts

Posted

I am trying to make it so that the drop down list from the Choose Your Recipient have a first entry called "Please Choose". That's the easy part. The hard part is making osCommerce disallow the default entry found in the drop down list.

 

I studied the function tep_draw_pull_down_menu in html_output.php, but couldn't figure it out. There must be a way that can make tep_draw_pull_down_menu disallow the first choice...But I don't know how to do it.

 

Does anyone else have the same trouble?

 

<?php 
	  if (CONTACT_US_LIST !=''){
				  echo '<tr><td class="main">'. SEND_TO_TEXT. '</td></tr>'
			 		.'<tr><td class="main">';
			 if(SEND_TO_TYPE=='radio'){
			 foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {
				if($k==0){
				$checked=true;
				}else{
				$checked=false;
				}
				echo tep_draw_radio_field('send_to', "$k", $checked). " " .preg_replace('/\<[^*]*/', '', $v)."<br>\n";
			 }

		   }else{
			   foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {
					$send_to_array[] = array('id' => $k, 'text' => preg_replace('/\<[^*]*/', '', $v));
				 }
			echo tep_draw_pull_down_menu('send_to',  $send_to_array, 'Please Choose');
		   }

		echo "\n</td></tr>\n";

		}
		 ?>

Posted

why bother? there is a contribution that already does that.. go to the contributions section and download it

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Posted

I must be insane.

 

I've searched the forums and the contributions for this and couldn't find anything that would solve the problem. What contribution are you talking about?

Posted

there are contributions like the helpdesk that use something like that.

http://www.oscommerce.com/community/contributions,859

 

To disallow the first choice simply do not process it when the form is submitted. Instead use the error function and submit an error $messageStack->add

 

See how the contact_us and create_account script do that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...