[phpBB Debug] PHP Warning: in file [ROOT]/ext/tas2580/seourls/event/listener.php on line 213: Undefined array key "FORUM_NAME"
Problem mit Select und REX_VALUE erweiterung - REDAXO Forum
Hallo,

Wir haben in letzter Zeit festgestellt, dass die Kommunikation via Slack viel schneller und zielführender ist als ein Beitrag im Forum. Aufgrund der neuen und besseren Möglichkeiten der Kommunikation haben wir uns entschlossen das Forum nur noch als Archiv zur Verfügung zu stellen. Somit bleibt es weiterhin möglich hier nach Lösungen zu suchen. Neue Beiträge können nicht mehr erstellt werden.

Wir empfehlen, für deine Fragen/Probleme Slack zu nutzen. Dort sind viele kompetente Benutzer aktiv und beantworten jegliche Fragen, gerne auch von REDAXO-Anfängern! Slack wird von uns sehr intensiv und meistens "rund um die Uhr" benutzt :-)
Selbst einladen kannst Du dich hier: https://redaxo.org/slack/
1uck3r
Beiträge: 21
Registriert: 30. Aug 2007, 11:24
Kontaktdaten: ICQ

Problem mit Select und REX_VALUE erweiterung

10. Sep 2007, 08:46

Hallo ich hab ein Problem mit Select und der REX_VALUE erweiterung.
Der Thread im Forum konnte mir leider nicht helfen. Ich hoffe ihr könnte mir helfen.

Meine Selectboxen können sich die einträge nicht merken wenn man sie wieder editieren will sind die werte nicht wieder da. Und ich weiß nicht wieso.
Speichert man sie ab sind sie erst da. Will man dann was editieren fehlt alles und alles is wieder beim alten.

MFG André Gerdes

Eingabe Code:

Code: Alles auswählen

<?php
$rexname = split("~~", "REX_VALUE[1]");
?>

Waschmaschiene:
<select name="rexname[1]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[1]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Backofen:
<select name="rexname[2]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[2]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<br><option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Dusche:
<select name="rexname[3]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[3]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Kinderhochstuhl:
<select name="rexname[4]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[4]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Terasse:
<select name="rexname[5]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[5]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Gartenbenutzung:
<select name="rexname[6]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[6]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Geschirrspüler:
<select name="rexname[7]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[7]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Mikrowelle:
<select name="rexname[8]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[8]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Wannenbad:
<select name="rexname[9]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[9]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Kinderbett:
<select name="rexname[10]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[10]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Balkon:
<select name="rexname[11]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[11]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Herd 4-Plat:
<select name="rexname[12]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[12]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Kühlschrank:
<select name="rexname[13]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[13]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Radio:
<select name="rexname[14]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[14]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Internetanschluss:
<select name="rexname[15]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[15]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Grill:
<select name="rexname[16]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[16]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Schaukel:
<select name="rexname[17]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[17]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Gefrierfach:
<select name="rexname[18]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[18]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

CD/DVD:
<select name="rexname[19]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[19]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

SAT/Kabel-TV:
<select name="rexname[20]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[20]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Parkplatz:
<select name="rexname[21]">
<?php
$options = array('Nein', 'Ja');
$current = "rexname[21]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Fake Eintrag keine Änderung nötig!!!:
<select name="rexname[22]">
<?php
$options = array('Ja');
$current = "rexname[22]";

foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select><br>

Ausgabe Code:

Code: Alles auswählen

<style type="text/css">
#ja {
	text-decoration: none;
	background: transparent url('/files/ja.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top:5px;
	float:left;
	clear:both;
}
#ja2 {
	text-decoration: none;
	background: transparent url('/files/ja.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top: 5px;
	float:left;
	clear:both;
}
#ja3 {
	text-decoration: none;
	background: transparent url('/files/ja.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top:5px;
	float:left;
	clear:both;
}
#ja4 {
	text-decoration: none;
	background: transparent url('/files/ja.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top:5px;
	float:left;
	clear:both;
}

#nein {
	text-decoration: none;
	background: transparent url('/files/nein.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top:5px;
	float:left;
	clear:both;
}
#nein2 {
	text-decoration: none;
	background: transparent url('/files/nein.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top:5px;
	float:left;
	clear:both;
}
#nein3 {
	text-decoration: none;
	background: transparent url('/files/nein.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top:5px;
	float:left;
	clear:both;
}
#nein4 {
	text-decoration: none;
	background: transparent url('/files/nein.jpg') left center no-repeat scroll;
	padding-left: 20px;
	padding-top:5px;
	float:left;
	clear:both;
}
#check1
{
float:left;
padding-left:10px;
padding-bottom:10px;
}
#check2
{
float:left;
padding-left:62px;
}
#check3
{
float:left;
padding-left:62px;
}
#check4
{
float:left;
padding-left:62px;
color:
}
</style>
<body>
<?php
$rexname = split("~~", "REX_VALUE[1]");

$ausstattung = array("Waschmaschine","Backofen","Dusche","Kinderhochstuhl","Terasse","Gartenbenutzung","Geschirrspüler","Mikrowelle","Wannenbad","Kinderbett","Balkon","Herd 4-Plat.","Kühlschrank","Radio","Internetanschluß","Grill","Schaukel","Gefrierfach","CD/DVD","SAT/Kabel-TV","Parkplatz","Fake");

$i = 0;
echo'<fieldset style="border : 1px solid #3366CC;"><legend><strong><h3>Ausstatung</h3></strong></legend>';
echo '<div id="check1">';
foreach ($rexname as $rexnewname) 
{
		$rex = $i;
		if($rexnewname == "Ja")
		{
    		if($i <= 5)
			{
			echo '<div id="ja">'.current($ausstattung).'</div>';
			next($ausstattung);
			$i++;
			}
			
		}
		else
		{
			if($i <= 5)
			{
			echo '<div id="nein">'.current($ausstattung).'</div>';
			next($ausstattung);
			$i++;
			}
		}
}
echo '</div>';

$i = 0;
echo '<div id="check2">';
foreach ($rexname as $rexnewname) 
{
		$rex = $i;
		if($rexnewname == "Ja")
		{
    		if($i >5 && $i <= 10)
			{
			echo '<div id="ja2">'.current($ausstattung).'</div>';
			next($ausstattung);
			
			}
			$i++;
		}
		else
		{
			if($i >5 && $i <= 10)
			{
			echo '<div id="nein2">'.current($ausstattung).'</div>';
			next($ausstattung);
			
			}
			$i++;
		}
}
echo '</div>';

$i = 0;
echo '<div id="check3">';
foreach ($rexname as $rexnewname) 
{
		$rex = $i;
		if($rexnewname == "Ja")
		{
    		if($i > 10 && $i <= 15)
			{
			echo '<div id="ja3">'.current($ausstattung).'</div>';
			next($ausstattung);
			
			}
			$i++;
		}
		else
		{
			if($i > 10 && $i <= 15)
			{
			echo '<div id="nein3">'.current($ausstattung).'</div>';
			next($ausstattung);
			
			}
			$i++;
		}
}
echo '</div>';

$i = 0;
echo '<div id="check4">';
foreach ($rexname as $rexnewname) 
{
		$rex = $i;
		if($rexnewname == "Ja")
		{
    		if($i > 15 && $i <= 20)
			{
			echo '<div id="ja4">'.current($ausstattung).'</div>';
			next($ausstattung);
			
			}
			$i++;
		}
		else
		{
			if($i > 15 && $i <= 20)
			{
			echo '<div id="nein4">'.current($ausstattung).'</div>';
			next($ausstattung);
			
			}
			$i++;
		}
}
echo '</div>';
echo '</fieldset>';
?>

Benutzeravatar
Markus.Staab
Entwickler
Beiträge: 9634
Registriert: 29. Jan 2005, 15:50
Wohnort: Aschaffenburg/Germany
Kontaktdaten: ICQ Website

10. Sep 2007, 09:03

Hi,

statt

$current = "rexname[21]";

muss es glaub ich

$current = $rexname[21];

heissen.

Das natürlich dann bei allen Feldern..

Gruß,
Markus

1uck3r
Beiträge: 21
Registriert: 30. Aug 2007, 11:24
Kontaktdaten: ICQ

10. Sep 2007, 09:06

Hi danke für die schnelle antwort hat aber leider auch nicht funktioniert hmm mal sehen ich bin imoment mitn tunnelblick bei der arbeit :D

Benutzeravatar
VX500
Beiträge: 14
Registriert: 13. Dez 2012, 02:15
Wohnort: Bremen

Re: Problem mit Select und REX_VALUE erweiterung

14. Dez 2015, 06:21

Hallo,

ich habe das gleiche Problem mit dem Select in einem Modul. Der Wert kann ausgewählt werden, wird auch korrekt übergeben und im Frontend an gewünschter Stelle angezeigt. Den Code dazu fand ich hier http://rexvideo.de/tutorials/videotutor ... ctbox.html

Ruft man aber im Backend den Slice mit dem Modul erneut auf, wird im Select stets der erste Wert aus dem Array als Vorauswahl angezeigt, nicht jedoch der ursprünglich ausgewählte. So wird leider schnell beim Editieren unbeabsichtigt auf den ersten Wert abgeändert.

Code: Alles auswählen

<b>In welchem Ort befindet sich der Betrieb?</b><br /><br />

<select name="VALUE[3]">
<?php
$options = array('29699 Bomlitz' , '29664 Walsrode' , '29683 Fallingbostel');
$current = "REX_VALUE[3]";
 
foreach ( $options as $option)
{
  $selected = $option == $current ? ' selected="selected"' : '';
  echo '<option'. $selected .'>'. $option .'</option>';
}
?>
</select>
Wie erreiche ich, dass der vom Benutzer ausgewählte Wert beim nächsten Aufruf des Moduls im Backend als Voreinstellung angezeigt wird?

Grüße
Sascha

Benutzeravatar
Thomas.Blum
Entwickler
Beiträge: 5063
Registriert: 24. Aug 2004, 22:11
Wohnort: Dresden
Kontaktdaten: Website

Re: Problem mit Select und REX_VALUE erweiterung

14. Dez 2015, 09:14

Hej Sascha,

mach mal in deiner foreach Schleife ein

Code: Alles auswählen

echo '>>' . $option . ' == ' . $current . '<<<br />';
Sind die Werte irgendwann tatsächlich gleich?

Und nebenbei, bist du hier in der Version 3 richtig oder betrifft es Redaxo 4?

vg Thomas

Benutzeravatar
VX500
Beiträge: 14
Registriert: 13. Dez 2012, 02:15
Wohnort: Bremen

Re: Problem mit Select und REX_VALUE erweiterung

16. Dez 2015, 01:01

Hallo Thomas,

ja deine Modifikation war's! Jetzt bleiben die vom Benutzer eingestellten Werte auch bei erneuten Aufruf des Moduls als Voreinstellung bestehen. So soll's sein. Das könnte ggf. auch für Andere ganz informativ sein.

Es geht um eine Rexdaxo 4.6.2 Installation.
Da ich aber die Suchfunktion benutzt hatte, und diesen Artikel inhaltlich zutreffend fand, hatte ich das mit der R3 tatsächlich übersehen.

Danke für die Hilfe!
Sascha

Zurück zu „Allgemeines [R3]“