Jump to content

phippu
 Share

Recommended Posts

Hello everyone!

I'm stumbling upon a form, again... I'm trying to get the Text out of my Form with the newline characters. I'm using PW 2.5.3

What I have in Code a little bit cut down:

$form = $modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name",'subscribe-form');

// create a textarea input for the actual message
$field = $modules->get("InputfieldTextarea");
$field->label = "Nachricht";
$field->attr('id+name','message');
$field->required = 1;
$form->append($field); // append the field to the form

// form was submitted so we process the form
if($input->post->submit) {

    $message = $sanitizer->textarea($form->get("message")->value);

	$out .= "<strong>Nachricht:</strong></br>";	
	$out .= $message."</p>";

} else {
    // render out form without processing
    $out .= $form->render();
}

I can't get it with newlines, what am I doing wrong?

 

Thanks in advance for your support :-) 

Link to comment
Share on other sites

Sanitizer removes linefeeds. Allow multiline in the options array. This one should work:

$message = $sanitizer->textarea($form->get("message")->value, array('multiLine' => true));
// or 
$message = $sanitizer->textarea($input->post->message, array('multiLine' => true));

 

Link to comment
Share on other sites

Sorry I forgot an important detail, it was a little bit late yesterday :-)

@kixe I tried this "multiline" option. Unfortunately it doesn't work.

I also tried the following code:

$message = $form->get("message")->value;

$message does not contain newline characters, so I suspect to set an option in this code:

$field = $modules->get("InputfieldTextarea");
$field->label = "Nachricht";
$field->attr('id+name','message');
$field->required = 1;
$form->append($field); // append the field to the form

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...