Page 1 of 1
Removing fields in Guestbook module.
Posted: Thu Sep 07, 2006 4:49 pm
by dec
Core 0.13, newest Guestbook module.
Should be relatively straightforward, trying to remove the country, location and homepage fields in the entry form. After properly (or not so) removing it from the code it shows the success screen but when I return to the guestbook index then it doesn't. I don't code PHP therefore reading it was painful enough for me

I'm guessing its a field count boolean somewhere that doesn't return true. Any suggestions?
Thanks in advance,
Andrus
Re: Removing fields in Guestbook module.
Posted: Sun Sep 10, 2006 2:20 pm
by Dee
Without any PHP knowledge I don't think you'll be able to get rid of those fields as it would require quite a lot of changes to both the form creation and the SQL commands related to the modules_guestbook table.
Maybe some day someone will make the guestbook module's entry fields more configurable (kinda like formbuilder, maybe using SjG's new "Module Lightweight Form API" module,
http://dev.cmsmadesimple.org/scm/?group_id=219), but I don't think I will have the time to do so in the near future.
Re: Removing fields in Guestbook module.
Posted: Mon Sep 11, 2006 4:37 am
by Dr.CSS
If you look in the 'view source' of the rendered page with the form on it you may find some classes that you can use 'display: none' on.
Re: Removing fields in Guestbook module.
Posted: Tue Jan 22, 2008 4:17 pm
by Geo
turning all the fields you *dont* want to "hidden" and deleting the "$title.xxx" allows you to remove fields you dont want in a none destructive way. to tidy up the layout on the new "post" section i then just removed the additional table markers.
heres my sample amended code removing all but the "name" and "post" fields:
Code: Select all
<!-- Frontend Guestbook Entry Form //-->
<div class="cms-guestbook-div-insert">
<form name="insert" action="{$geturl}" method="post">
<input type="hidden" name="uid" value="{$uid}" />
<table>
<tr>
<td>{$titles.sender}(*):</td>
<td><input type="text" name="sender" value="{$values.sender}" /></td>
<td><input type="hidden" name="country" value="{$values.country}" /></td>
<td><input type="hidden" name="location" value="{$values.location}" /></td>
<td><input type="hidden" name="e_mail" value="{$values.e_mail}" /></td>
<td><input type="hidden" name="homepage" value="{$values.homepage}" /></td>
</tr>
<tr>
<td>{$titles.chars_remaining}:</td>
<td>
<__script__ type="text/javascript">
<!--
{literal}
function addEvent(elm, evType, fn, useCapture)
// cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// by Scott Andrew
{
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
} else {
elm['on' + evType] = fn;
}
}
{/literal}
{if $wysiwyg}
{literal}
function FCKeditor_OnComplete(editorInstance) {
addEvent(editorInstance.EditorDocument, 'keyup', checkLen, false);
}
{/literal}
{/if}
{if !$wysiwyg}
{literal}
function addListeners() {
var messageinput = document.getElementById('message');
addEvent(messageinput, 'keyup', checkLen, false);
}
{/literal}
{/if}
{literal}
function checkLen() {
{/literal}
maxLen="{$max_textleng}";
// sTooLong = 'Insert maximal ' + maxLen + ' characters!';
sTooLong = "{$toolong}";
{if $wysiwyg}
{literal}
var oEditor = FCKeditorAPI.GetInstance('message');
var oDOM = oEditor.EditorDocument;
var iLength;
if (document.all) // Internet Explorer.
{
iLength = oDOM.body.innerText.length;
}
else // Gecko.
{
var r = oDOM.createRange();
r.selectNodeContents(oDOM.body);
iLength = r.toString().length;
}
if(iLength>maxLen)
{
oDOM.body.innerHTML = oEditor.GetXHTML(false).substring(0,oEditor.GetXHTML(false).length-1);
alert(sTooLong);
}
else
{
document.insert.counter.value=maxLen-iLength;
}
{/literal}
{else}
{literal}
var txt=document.insert.message.value;
if(txt.length>maxLen)
{
alert(sTooLong);
document.insert.message.value=txt.substring(0,maxLen);
document.insert.counter.value=0;
}
else
{
document.insert.counter.value=maxLen-txt.length;
}
{/literal}
{/if}
{literal}
}
{/literal}
{if !$wysiwyg}
addEvent(window, 'load', addListeners, false);
{/if}
//-->
</__script>
<input type="text" name="counter" value="{$counter}" size="4" />
</td>
</tr>
<tr>
<td>{$titles.message}(*)</td>
<td>
{if $wysiwyg}
{$wysiwyg}
{else}
<textarea name="message" id="message" rows="10" cols="40">{$values.message}</textarea>
{/if}
</td>
</tr>
{if $show_captcha}
<tr>
<td colspan="2" align="center">
{$titles.captcha}: <input type="text" name="captcha_phrase" /><br />
{$captcha}
</td>
</tr>
{/if}
<tr>
<td colspan="2" align="center">
<input type="submit" name="submitted" value="{$labels.insert}"> <input type="submit" name="cancel" value="{$labels.cancel}" />
</td>
</tr>
</table>
</form>
</div>
Geo.
Re: Removing fields in Guestbook module.
Posted: Wed Jan 23, 2008 8:13 pm
by tobik
With the latest SVN guestbook version you may also remove the fields altogether from the html form.