My first time at making a feature and im already lost

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
windstarfire
Registered User
Posts: 21
Joined: Mon Apr 03, 2006 9:00 am

My first time at making a feature and im already lost

Post 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
User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion »

You should get better help with this in MOD Writers Discussion. moved...
itsallgood
Registered User
Posts: 76
Joined: Wed May 05, 2004 8:54 pm

Post 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.
windstarfire
Registered User
Posts: 21
Joined: Mon Apr 03, 2006 9:00 am

Post 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?
Post Reply

Return to “[2.0.x] MOD Writers Discussion”