Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Adding more form fields to post.pl (Read 2754 times)
DigiTech ID
Full Member
***
Offline


AKA Neo Plan 3, Neo Digital
3, Audiodox, etc...

Posts: 205
Location: Media
Joined: Oct 11th, 2001
Gender: Male
Adding more form fields to post.pl
Feb 16th, 2002 at 5:32am
Print Post  
I need to add more form fields to post.pl, I've got the adding forms down, but I don't know how to get the information to the posting index. Here's what I've got so far:

Field 1: [Field]
Field 2: [Field]
Field 3: [Field]
Field 4: [Field]
Subject: [Suject]
Message area: [Message Area]
Attach file(using gold release): [File Field][Attach]
[Submit] [Reset]

I need to know how to send the information from Fields 1-4 to the same area as the message.
i.e.

Field 1 information
Field 2 information
Field 3 information
Field 4 information

Message

Can any one tell me how to accomplish this ???

Thanx,

NP3
  

Looks like there's work yet to be done...

Pitty, never even made it past YaBB 1 SP1.1
Back to top
WWWAIM  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: Adding more form fields to post.pl
Reply #1 - Feb 16th, 2002 at 4:22pm
Print Post  
Well first, you have to give each of these fields a name like <input name="field1"> etc.

Then you have to save the values from those fields in sub post2 into the thread file. The variables would be called $FORM{'field1'} etc.

After that, you have to edit Display.pl and read out the additional data from this thread file and add them to the post output.
  

The Administrator.
Back to top
WWW  
IP Logged
 
DigiTech ID
Full Member
***
Offline


AKA Neo Plan 3, Neo Digital
3, Audiodox, etc...

Posts: 205
Location: Media
Joined: Oct 11th, 2001
Gender: Male
Re: Adding more form fields to post.pl
Reply #2 - Feb 16th, 2002 at 5:07pm
Print Post  
Could you give me more detailed instructions on that? I'm not exactly sure how to get the information from the field to the message to the display. Heres what I've got so far:

Changed area of sub Post2:
Code
Select All
sub Post2 {
	if($username eq 'Guest' && $enable_guestposting == 0) {	&fatal_error($txt{'165'}); }
	my( $email, $subject, $testfield, $icon, $ns, $threadid, $notify, @memberlist, $a, $realname, $membername, $testname, @reserve, @reservecfg, $matchword, $matchcase, $matchuser, $matchname, $namecheck, $reserved, $reservecheck, $newthreadid, @messages, $mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate, $start, $pageindex, $tempname );

	# If poster is a Guest then evaluate the legality of name and email
	if(!$settings[2]) {
		$FORM{'name'} =~ s/\A\s+//;
		$FORM{'name'} =~ s/\s+\Z//;
		&fatal_error($txt{'75'}) unless ($FORM{'name'} ne '' && $FORM{'name'} ne '_' && $FORM{'name'} ne ' ');
		&fatal_error($txt{'568'}) if(length($FORM{'name'}) > 25);
		&fatal_error("$txt{'76'}") if($FORM{'email'} eq '');
		&fatal_error($txt{'243'}) if($FORM{'email'} !~ /^[0-9A-Za-z@\._\-]+$/);
		&fatal_error("$txt{'500'}") if(($FORM{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/) || ($FORM{'email'} !~ /^.+@\[?(\w|[-.])+\.[a-zA-Z]{2,4}|[0-9]{1,4}\]?$/));
	}

	# Get the form values
	$name = $FORM{'name'};
	$email = $FORM{'email'};
	$subject = $FORM{'subject'};
	$message = $FORM{'message'};
 	$icon = $FORM{'icon'};
	$ns = $FORM{'ns'};
	$threadid = $FORM{'threadid'};
	if( $threadid =~ /\D/ ) { &fatal_error($txt{'337'}); }
	$notify = $FORM{'notify'};
	$testfield = $FORM{'testfield'}; 



The field itself(below the subject field:
Code
Select All
		  <tr>
			<td align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Test
			  Form:</font></td>
			<td>
			  <input type="text" name="testfield" size="40">
			</td>
		  </tr> 



That's 'bout all I can figure out to do, it dosn't even send the information to message file. Can you tell me what I'm missing?

Thanx,
NP3
  

Looks like there's work yet to be done...

Pitty, never even made it past YaBB 1 SP1.1
Back to top
WWWAIM  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: Adding more form fields to post.pl
Reply #3 - Feb 16th, 2002 at 10:44pm
Print Post  
You have to save the additional field to the datafile. Todo so, open Post.pl and look for

Code
Select All
		print FILE qq~$subject|$name|$email|$date|$username|$icon|0|$user_ip|$message|$ns|\n~; 


and reaplce that with

Code
Select All
		print FILE eld\n~; 


then look for

Code
Select All
		print FILE qq~$subject|$name|$email|$date|$username|$icon|0|$user_ip|$message|$ns|\n~; 


and replace that with

Code
Select All
		print FILE eld\n~;
 



now in Display.pl, you have to replace

Code
Select All
		($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $postmessage, $ns, $mlm, $mlmb) = split(/[\|]/, $_); 

with

Code
Select All
		($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $postmessage, $ns, $mlm, $mlmb, $testfield) = split(/[\|]/, $_); 



Now, you have the variable $testfield available the Display sub so that you can simple add it to the post output.

But there is something you have to change too: if you edit your post, you'll loose this extra field in the datafile. To prevent this, you have to edit ModifyMessage.pl too:

Code
Select All
		($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns, $mlm, $mlmb) = split( /\|/, $messages[$postid]); 


replaced by

Code
Select All
		($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns, $mlm, $mlmb, $testfield) = split( /\|/, $messages[$postid]); 


and

Code
Select All
		$messages[$postid] = |$username\n~; 

must be replaced by

Code
Select All
		$messages[$postid] = |$username|$testfield\n~; 



I didn't test this code and there are hundreds of other places where this additional code should be added like in the preview and stuff but I don't have the time to write you a whole mod out if this here right now.
  

The Administrator.
Back to top
WWW  
IP Logged
 
DigiTech ID
Full Member
***
Offline


AKA Neo Plan 3, Neo Digital
3, Audiodox, etc...

Posts: 205
Location: Media
Joined: Oct 11th, 2001
Gender: Male
Re: Adding more form fields to post.pl
Reply #4 - Feb 16th, 2002 at 10:47pm
Print Post  
I think I can figure the rest from here, Thanx!
  

Looks like there's work yet to be done...

Pitty, never even made it past YaBB 1 SP1.1
Back to top
WWWAIM  
IP Logged
 
DigiTech ID
Full Member
***
Offline


AKA Neo Plan 3, Neo Digital
3, Audiodox, etc...

Posts: 205
Location: Media
Joined: Oct 11th, 2001
Gender: Male
Re: Adding more form fields to post.pl
Reply #5 - Feb 17th, 2002 at 12:42am
Print Post  
heehee.. one more question, will this work with gold as well?
  

Looks like there's work yet to be done...

Pitty, never even made it past YaBB 1 SP1.1
Back to top
WWWAIM  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: Adding more form fields to post.pl
Reply #6 - Feb 17th, 2002 at 12:50am
Print Post  
it should, yes. However, the code might deviate in some small parts...
  

The Administrator.
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint