Page 1 of 1

My first time at making a feature and im already lost

Posted: Fri Apr 07, 2006 10:58 am
by windstarfire
Hey guys, well basically, its like this:

In phpbb, when you post, and im the message place (here) when you leave it empty it says "You must enter a message before posting", its great as you dont post empty posts and stuff

I have a uploading picture script, on my site, ((C) Stickied Group)
Im wanting to somehow to add a script or something that can be made into the "Sticky It!" button so that if its empty or hasnt choosed a file to upload it'll say "Please select a file before stickying"

Im so lost,
I added this in the posting_body.tpl

Code: Select all

function checkUpload() {

	formErrors = false;    

	if (document.post.message.value.length < 2) {
		formErrors = "{L_EMPTY_UPLOAD}";
	}

	if (formErrors) {
		alert(formErrors);
		return true;
} else {
		bbstyle(-1);
		//formObj.preview.disabled = true;
		//formObj.submit.disabled = true;
		return true;
	}
}
Added this in posting.php

Code: Select all

'L_EMPTY_UPLOAD' => $lang['Empty_upload'],
and this in posting_body.tpl again

Code: Select all

<form action="http://www.stickied.net/index.php" method="post" enctype="multipart/form-data" target="_blank" method="post" name="post" onsubmit="return checkUpload(this)">
^^thats one line of the script...

and in lang_main (in lang_english folder)

Code: Select all

$lang['Empty_upload'] = 'You must select a file to upload before sticking.';

anyone please help, i dont want a solution preferably, but someone to teach me how to do it and where more to add, as i want to learn

thanks
Copyright Stickied Group2006 Posted after permission

Posted: Fri Apr 07, 2006 4:36 pm
by Black Fluffy Lion
You should get better help with this in MOD Writers Discussion. moved...

Posted: Fri Apr 07, 2006 7:46 pm
by itsallgood
Hiya matey,

I'm not really sure what you mean?

Do you mean if the user hasnt ticked a box on the form, then the error box pops up to say "Somthings wrong!"???

You can do this in the posting_body.tpl

near the top, look for this:

Code: Select all

function checkForm() {

	formErrors = false;    

	if (document.post.message.value.length < 2) {
		formErrors = "{L_EMPTY_MESSAGE}";
	}

	if (formErrors) {
		alert(formErrors);
		return false;
	} else {
		bbstyle(-1);
		//formObj.preview.disabled = true;
		//formObj.submit.disabled = true;
		return true;
	}
}
If your trying to do what i think you are (which im not sure ;) )

you need to add a new IF statement, for a tickbox, it would be like this:

Code: Select all

		if (!document.post.terms.checked) {
		formErrors = "This box is not ticked!";
	}
If this is on the right lines, but i've not explained it right, let me know.

If its nothing like what your doing, i'll shut up. lol

Cheers.

Posted: Mon Apr 17, 2006 4:45 am
by windstarfire
hey, well i dont know how to explain, its basically if you want to upload a file (picture) but you didnt choose anything and you pressed upload, it uses iframes of another site (stickied.net)

so do i edit something in phpbb or the web page?