• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Problem with drop down box

Problem with drop down box 16 years 8 months ago #4510

  • madhangc
  • madhangc's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Hi all, I have a contact us form in my site wherein i have state field which is a Drop-down list box. I have given wisconsin as my default value which is,
Wisconsin[c]
My issue is, if the user enters irrelevent data after validation the dropdown list contains the first state i.e., Alabama instead of wisconsin. I don't have problems with other states(which dosen't contain [c]) which remains as selected after the form is returned if there are errors. The field which contains the [c] isn't correctly selected.

Any ideas how to solve the problem.

Thanks in advance..

\madhan
The administrator has disabled public write access.

Re:Problem with drop down box 16 years 8 months ago #4515

  • richiep
  • richiep's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 131
Sounds like a bug.

I'd submit a ticket to tech support and see what they say.

Good Luck
Richieo
The administrator has disabled public write access.

Re:Problem with drop down box 16 years 8 months ago #4516

  • madhangc
  • madhangc's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Hi richiep thanx for the reply and posting that as a ticket. I somehow managed to hack it. I have the given the entire case with the code i added. Hope it helps the community,
case 'selectList':
			{
				$data=RSgetComponentProperties($componentId);
				if($data['MULTIPLE']=='YES') $out.=\"<select multiple name=\\"form[$data[NAME]][]\\" size=\\"$data[SIZE]\\" id=\\"$data[NAME]\\" $data[ADDITIONALATTRIBUTES]>\";
				else $out.=\"<select size=\\"$data[SIZE]\\" name =\\"form[$data[NAME]][]\\" id=\\"$data[NAME]\\" $data[ADDITIONALATTRIBUTES]>\";
				$aux = RSisCode($data['ITEMS']);
 
				$aux=str_replace(\"\r\",\"\",$aux);
				$items=explode(\"\n\",$aux);
				foreach($items as $item)
				{
					$item = stripslashes($item);
					$buf=explode(\"|\",$item);
					if(count($buf)==1)
					{
						if(empty($value))
							//echo $value;
							//print_r($value);
							if(preg_match('/\[c\]/',$buf[0]))
							{
								//echo $value;
								$out.='<option selected=\"selected\" value=\"'.$buf[0].'\">'.str_replace('[c]','',$buf[0]).\"</option>\";
							}
							else
							{
								$out.='<option value=\"'.$buf[0].'\">'.$buf[0].'</option>';
							}
						else if(!empty($value[$data['NAME']]))
							if(array_search(str_replace('[c]','',$buf[0]),$value[$data['NAME']])!==false)
							{
								$out.='<option selected=\"selected\" value=\"'.$buf[0].'\">'.str_replace('[c]','',$buf[0]).\"</option>\";
							}
							else
							{
					/*custmisation starts by madhan for retaining the selected value applies only to\"[c]\"*/
							if($buf[0]==$value[state][0])
							{
								$out.='<option selected=\"selected\"  value=\"'.$buf[0].'\">'.str_replace('[c]','',$buf[0]).\"</option>\";
							}
							else
							{
								$out.='<option value=\"'.$buf[0].'\">'.str_replace('[c]','',$buf[0]).\"</option>\";
							}
					/*custmisation ends by madhan for retaining the selected value applies only to\"[c]\"*/
						}
						else
							$out.='<option value=\"'.$buf[0].'\">'.str_replace('[c]','',$buf[0]).\"</option>\";
					}
					if(count($buf)==2)
					{
						if(empty($value))
							if(preg_match('/\[c\]/',$buf[1]))
								$out.=\"<option selected=\\"selected\\" value=\\"$buf[0]\\">\".str_replace('[c]','',$buf[1]).\"</option>\";
							else
								$out.=\"<option value=\\"$buf[0]\\">$buf[1]</option>\";
						else if(!empty($value[$data['NAME']]))
							if(array_search(str_replace('[c]','',$buf[0]),$value[$data['NAME']])!==false)
								$out.=\"<option selected=\\"selected\\" value=\\"$buf[0]\\">\".str_replace('[c]','',$buf[1]).\"</option>\";
							else
								$out.=\"<option value=\\"$buf[0]\\">\".str_replace('[c]','',$buf[1]).\"</option>\";
						else
							$out.=\"<option value=\\"$buf[0]\\">\".str_replace('[c]','',$buf[1]).\"</option>\";
					}
				}
				$out.='</select>';
			}break;

Thanx again for the initiative.

\madhan
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!