TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 460
  • Total: 460

Generic Application Form

Started by JPDeni, May 23, 2009, 11:04:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sysd0wn

Are there any known issues with this on TPv1.0 beta 4? I've been trying to get this to work. I pasted this code into a .php and called for it in an article, but it always says 'you need to be logged in' regardless of whether or not you are logged in. I have also attempted to put this straight into a PHP article, but then it won't even save. It returns a 500 Internal Server Error.

Any ideas?

JPDeni

QuoteI pasted this code into a .php and called for it in an article
QuoteI have also attempted to put this straight into a PHP article

I don't know what either one of those things means. You need to create a php article from within TP, paste the code into the article and save it.

No one has brought up any issues with beta 4. Are you able to save any other php file?

sysd0wn

What I meant was, I saved the code in a file called "application.php" and changed my article type to External Article. This method always says "You must be logged in before you can apply".

For the second, I did exactly what you said - Create a php article, paste, save. And it gives me an internal server error.

I am able to save just plain text in a php article, but it seems to give me an error whenever I add code.

JPDeni

QuoteI saved the code in a file called "application.php" and changed my article type to External Article.

It wasn't designed for that. It was designed to go into a php article.

QuoteI am able to save just plain text in a php article, but it seems to give me an error whenever I add code.

Then your problem isn't with my code. The best thing to do is to start a topic for support with your php article problem.

Uthn

Thanks the code JPDeni, works fine except for one little thing mainly due to the fact that i don't use English language in it.

French language uses 'special' characaters that cause some issues, here's an exemple

"c'est l'heure" becomes "c\'est l\'heure"

any clue ? :)

thanks

JPDeni


tragidy

Hi,

First I would like to say thanks for the code, it works really well, however ive found one issue with this, however it should be fixable.

Here is an example of an array i used.

array(
'caption' =>      "<FONT COLOR=red>Age</font>",
'name' =>         "age",
'type' =>         "select",
'options' =>      "13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
'defaultvalue' => "18",
'required' =>     1


If you note the color html or any html for that matter, ie; bold text

This all looks great on the form and looks great in the forum post however, if I go to modify the post exg; change topic from pending to accepted the body of the post becomes full of html that is out putted into html in the form of a php ' echo ' instead of keeping its coding.

I have attempted a solution with this line of your code.


if ($enable_post) {  //create new forum post with application

$postbody = 'Recruitment application has been made by  ' . $context['user']['name'] .'<br /><br/>';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= $field['caption'] . '<br />';
else
$postbody = '[html]' . $field['caption'] . ': ' . $_REQUEST[$field['name']] . '[/html]<br />';


This would solve the issue upon editing however after the alteration of adding [html] brackets after the application is posted it will only display the comments section.

I am using a stock copy of your code unaltered except for the alterations posted above obtained from the first page on this thread.

Any help or solutions you could provide would be great.

Thanks

JPDeni

QuoteThis all looks great on the form and looks great in the forum post however, if I go to modify the post exg; change topic from pending to accepted the body of the post becomes full of html that is out putted into html in the form of a php ' echo ' instead of keeping its coding./quote]

That's because the code wasn't written to do that. If you want to change the outputted formatting, you should change it in the output part of the code, not the field definitions.

tragidy

#38
What exactly wasn't the code written to do?

You have in the php comments that html/color is allowed, but when posted it appears fine but to modify the post will display the pure html with no remorse or line breaks upon saving.

$postbody = '[html]' . $field['caption'] . ': ' . $_REQUEST[$field['name']] . '[/html]<br />';

Should resolve the issue however, the code will only echo the last array when modified.

JPDeni

The code was not written to have html code included in the names of the fields.

My comments say the following:

$intro_form = "Put whatever introduction you want to appear at the top of the form here. You can add html. Be careful with quotation marks.";
$thanks_text = "This is what will appear after the form is submitted. You can use html. Be careful with quotation marks.";


Those comments apply to those variables only. The note about the caption says


Can include symbols and spaces.


Nothing about html. It's too complicated for a generic form, as you seem to have found out.

If you can find a way to resolve it, that's great, but it's not the way the code was intended.

This website is proudly hosted on Crocweb Cloud Website Hosting.