|
Posted by Rikoos on 01/02/07 18:56
Hi everybody,
I have a small problem and i don't know where to start.
The following:
I have a running Joomla CMS system with a component eventlist which is
written in PHP. Members are able to select event in the agenda and
able to mark a check box to let others to know the will attend this
event (this is shown in there profile and also shown at the event
agenda item.
I want to change this to a clickable link, so user don't have to mark
the checkbox and confirm this by clicking a button. When a member is
not already registered for a event there will be a clickable link with
something like "Add to personal agenda". If already registered a link
will be shown with something like "Remove from personal agenda".
The component is generating the following code:
<form name="Eventlist" action="index.php" method="post">
<input type="hidden" NAME="option" value="com_eventlist">
<input type="hidden" NAME="Itemid" value="56">
<input type="hidden" NAME="rdid" value="1573">
<input type="hidden" NAME="func" value="userregister">
Ik ga naar dit evenement: <input type="checkbox" name="reg_check"
onClick="check(this, document.Eventlist.senden)">
<br /><br />
<input type="submit" name="senden" value="Inschrijven " disabled>
</form>
<script language="JavaScript">
function check(checkbox, senden) {
if(checkbox.checked==true){
senden.disabled = false;
} else {
senden.disabled = true;
}
}
</script>
In the component code the following code is responsible for generating
the above code:
<?php
$jetzt = date("Y-m-d");
$now = strtotime($jetzt);
$date = strtotime($row->dates);
$timecheck = $now - $date;
if ($timecheck <= 0) {
if ($my->id) {
if (!$usercheck) {
if (!$usercheck) {
?>
<form name="Eventlist" action="index.php"
method="post">
<input type="hidden" NAME="option"
value="<?php echo $option ; ?>">
<input type="hidden" NAME="Itemid"
value="<?php echo $Itemid ; ?>">
<input type="hidden" NAME="rdid" value="<?php
echo $row->did ; ?>">
<input type="hidden" NAME="func"
value="userregister">
<?php echo _EVENTS_REGISTRA_REG." "; ?>
<input type="checkbox" name="reg_check"
onClick="check(this, document.Eventlist.senden)">
<br /><br />
<input type="submit" name="senden"
value="<?php echo _EVENTS_REGISTRA_BUTTON." "; ?>" disabled>
</form>
<script language="JavaScript">
function check(checkbox, senden) {
if(checkbox.checked==true){
senden.disabled = false;
} else {
senden.disabled = true;
}
}
</script>
<?php
} else {
if ($row->unregistra == 0) {
echo _EVENTS_REGISTRA_ALLRE." ";
} else {
?>
<form name="Eventlist" action="index.php"
method="post">
<input type="hidden" NAME="option"
value="<?php echo $option ; ?>">
<input type="hidden" NAME="Itemid"
value="<?php echo $Itemid ; ?>">
<input type="hidden" NAME="rdid" value="<?php
echo $row->did ; ?>">
<input type="hidden" NAME="func"
value="delreguser">
<?php echo _EVENTS_REGISTRA_UNREG." "; ?>
<input type="checkbox" name="reg_check"
onClick="check(this, document.Eventlist.senden)">
<br /><br />
<input type="submit" name="senden"
value="<?php echo _EVENTS_REGISTRA_BUTTON_UNREG." "; ?>" disabled>
</form>
<script
language="JavaScript">
function check(checkbox, senden) {
if(checkbox.checked==true){
senden.disabled = false;
} else {
senden.disabled = true;
}
}
</script>
<?php
}//ende
unregistra
}//ende usercheck
} else {
echo
_EVENTS_REGISTRA_LOGIN." ";
}//ende my->id
} else {
echo _EVENTS_REGISTRA_TOLATE."
";
}//ende timecheck
?>
Could somebody help me to change this checkbox into a clickable link?
Or maybe if you have some examples where this is done?
It would be very big step forward for me as i only recently started to
learn php so please be not to expert in replies ;)
Cheers
Rick
Navigation:
[Reply to this message]
|