Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-02-25 21:55:55
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
without hacking?
Is there a way I can add an attribute inside the form tag of the comment form without hacking the comments.php? I would like to add: name=“comment”
<txp:Ruhh />
Offline
Re: without hacking?
No. For JavaScript, just use the ID, #txpCommentInputForm
.
Last edited by jm (2008-02-25 21:58:25)
Offline
#3 2008-02-25 22:12:06
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: without hacking?
I tried using the id but it do not work.
This is the JS I want to put inside the head tags.
<script language=“javascript”>
<!—
function writeImgTag(code)
{
var cache = document.comments.text.value;
this.code = code;
document.comments.message.value = cache + “ !/smilies/” + code + “.gif! “;
document.comments.message.focus();
}
//—>
</script>
<txp:Ruhh />
Offline
Re: without hacking?
You need to use document.getElementById
. You don’t actually need the comment form’s name – the following should do it:
<script type="text/javascript">
function writeImgTag(code) {
var message = document.getElementById('message');
if (!message) return;
message.value = message.value + '!/smilies/' + code + '.gif!';
message.focus();
}
</script>
Last edited by jm (2008-02-25 22:54:14)
Offline
#5 2008-02-25 22:59:34
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: without hacking?
Oh thank you, it works like a charm!
Oh another question, what would the modified script look like if I wanted to replace the textile tag for image with the code I had in the an7_filter plugin?
Last edited by Ruhh (2008-02-26 11:37:55)
<txp:Ruhh />
Offline
Pages: 1