General Community > Scripting Help

more input in the Post form question

<< < (2/4) > >>

Spaceman-Spiff:
i see
if you wanna see what i did for the support board in yse.org, check the Post.php changes in this package: http://www.immortalshades.com/spaceman/mods/Support_Board_YSE_v1.3.zip

Anguz:
thank you for that code, now I know how to enable something in some boards from the admin area  :)

but I don't think I'll use the db for this hack... I already have the form working



this is the code to format the subject:

--- Code: ---   if ($board == 30) #test forum
      $subject = $subject_year . '-' . $subject_month . '-' . $subject_day . ' ' . trim($subject_source) . ' "' . trim($subject) .'"';
--- End code ---

if I just post the new thread, it's formatted correctly, but if I preview it first, then the previed subject line is fine, but when posting it applies the changes again, same if I preview more than once... like this:

just post: 03-02-15 Daily News "SMF rocks!"
preview+: -- "03-02-15 Daily News "SMF rocks!""

you can register and use the test board if you want:
http://llama.lewismedia.com/~anguz/forums/index.php?board=30

what can I do so that it'll just format the subject the first time and then work normally the others?

Spaceman-Spiff:
i think this code will be better:

--- Code: ---$subject = $subject_year . '-' . $subject_month . '-' . $subject_day . ' ' . trim($subject_source) . " \n\n\"" . htmlspecialchars(trim($subject)) .'"';
--- End code ---
added line breaks and htmlspecialchars (important for security)


--- Quote ---what can I do so that it'll just format the subject the first time and then work normally the others?
--- End quote ---
check my code in Post.php

Anguz:
I did it! ;D

I read your code again and found something that helped me solve it all... I couldn't do it like you, cause yours was right before saving it to the db, but I was putting the subject string together much earlier and then handling it like a normal subject

but, I found the condition to check if the thread was new ($threadid == ''), so I used that to know when to show the new fields in the form (before they were showing when replying to the thread too)

and together with the new fields, I added
--- Code: ---<input type="hidden" name="subject_format" value="true">
--- End code ---
and passed it to post2 to format the subject and then change it to false, that way it won't format the string again

thank you for your help!! ;D

I still haven't figured out how to make the person fill the extra fields before submitting with JavaScript, but it'll have to stay without it for now, cause I know cero JS  :(

Spaceman-Spiff:
check the js in the <form tag in onsubmit event

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version