On Thursday, October 20, 2016 at 9:13:56 AM UTC-7, Steven Vannoy wrote:
>
> I have an app in which users can fill out a form and then that form is 
> displayed in a view. The form has many fields, several of which are free 
> form text boxes, where type is 'text'. Specifically my db table is called 
> 'sites' and a field related to my question is 'other', in which a user 
> might enter a long description of information not captured in any of the 
> fields of the form. Currently, to display the field in my view, I am just 
> using:
>
> {{if len(site.other) > 0:}}
>     <h4> Miscellaneous "Other"</h4>
>         <p>{{=site.other}}</p>
> {{pass}}
>
>
> The text is being displayed in one long string. New lines (returns) that 
> the user entered in the form are not reflected in the output. I don't know 
> much about html, but I do know that in general it ignores new lines (you 
> have to use a tag like <br> to get a new line), but how can I display the 
> text the user entered into the form and have the new lines displayed? Some 
> users have also done indentation to display a list of items with asterisks 
> for bullets, so preferably that would render also. An example might be:
>
> We expect applicants to do the following
>   * show up on time
>   * dress professionally
>   * complete all tasks in a timely fashion
>
>
> I am currently not using a CSS style sheet, but I suspect that might be 
> part of the solution. Thus far, my view just has the default:
>
> {{extend 'layout.html'}}
>
>
> at the top and then my fields.
>
> Basically I want the functionality that this form that I'm filling out 
> right now has, my text will be rendered with new lines and indentations 
> just as I've typed them into this text box (note I don't need the fancy 
> code formating and all of the cool things I can do in this form). 
>
> Thanks
>

I'm going to go out on a limb, and opine that you never even get the 
newlines or indentation (but do get the asterisks), all that having been 
stripped out by the textarea input control.  You need something that 
actually makes it to you and that you can recognize as format control.  The 
easiest is probably to use web2py's wiki support:
<URL:http://web2py.com/books/default/chapter/29/03/overview#MARKMIN-basics>

(BTW, under the covers, you *are* using CSS style sheets ... either 
Bootstrap3 or stupid.css, depending on which layout.html you started with;
adding a *custom* style sheet probably isn't necessary for this task.)

/dps


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to