value=xhtml vs br
Posted: 23 May 2008 10:29 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  46
Joined  2007-09-10

Hello,

I am hitting a wall and can’t figure this out. I am using form helper to allow my clients to edit their pages. I am using the following code

<input type="hidden" name="{exp:form_helper:field_grabber field_name='body' which='format'}" value="xhtml" />

Which is supposed to put paragraph tags around items with a line break, right? Well, it works well the first time, but if you go in and edit a second time, it puts too many p tags in. Is it supposed to leave a br tag where there is just one line break and p tags where there are two?

Example html code before editing:

<div class="left">
<
h1>Teachers and Staff   &nbsp; &nbsp;[<a href="http://www.mchsf.com/index.php/about/edit_entry/11/">Edit</a>]</h1> <p><b>Curt Chamberlain, Director</b>

<
br />
Curt earned his BA in Psychology with a focus on Early Childhood from the University of Oregon, and received his Montessori primary credential from the Maria Montessori Teacher Training Center. For over 20 years, Curt was at the Berkeley Montessori School (BMS), where he taught primary and lower elementary classes before going on to become head of school. After leaving BMS in 2000, he was named head of The Abiqua School in Oregon, followed by a stint as head of both The Barrie School in Silver Spring, Maryland and The Chesapeake Montessori School in Annapolis. Curt’s outside interests include Berkeley City Ballet, where he was a principal dancer for many years, as well as president of its Board of Directors. His other passions include Thai cooking, theatre, opera and film. Curt joined MCH in 2007.
</p>

But, when I open that page in the editor, it has two line breaks in the editor...and once saved, it converst the text to the following:

<div class="left">
<
h1>Teachers and Staff   &nbsp; &nbsp;[<a href="http://www.mchsf.com/index.php/about/edit_entry/11/">Edit</a>]</h1> <p><b>Curt Chamberlain, Director</b>

</
p>
<
p>
Curt earned his BA in Psychology with a focus on Early Childhood from the University of Oregon, and received his Montessori primary credential from the Maria Montessori Teacher Training Center. For over 20 years, Curt was at the Berkeley Montessori School (BMS), where he taught primary and lower elementary classes before going on to become head of school. After leaving BMS in 2000, he was named head of The Abiqua School in Oregon, followed by a stint as head of both The Barrie School in Silver Spring, Maryland and The Chesapeake Montessori School in Annapolis. Curt’s outside interests include Berkeley City Ballet, where he was a principal dancer for many years, as well as president of its Board of Directors. His other passions include Thai cooking, theatre, opera and film. Curt joined MCH in 2007.
</p>

Why is it transforming a perfectly good br tag into a p tag? It this the correct behavoir or am I doing something wrong?

Profile
 
 
Posted: 23 May 2008 10:48 AM   [ Ignore ]   [ # 1 ]
Jr. Member
RankRank
Total Posts:  46
Joined  2007-09-10

Here’s the thing. When I edit the page and input text, it’s fine, it puts in a br tag if there is just one line break, but when I go to edit the page again, within the textarea edit box, it inserts another linebreak.... so that when I save it, it now has a p tag around it. Does that make more sense?

Profile
 
 
Posted: 23 May 2008 12:50 PM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Evoir,

This will probably come of little comfort, Formhelper is a little quirky this way.
If you force a linebreak, it always seems to want to make a new paragraph of it.
Formhelper is long overdue for an overhaul, but I don’t suspect any further development on it until after the release of EE 2.0… if it’s not replaced by then, that is. wink

Because you’re providing me the source code, it’s hard to see how you actually have this coded.... but…
I dare ask, why you don’t just set “Curt Chamberlain, Director” as another custom field? smile

 Signature 
Profile
 
 
Posted: 23 May 2008 01:11 PM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  46
Joined  2007-09-10

ah-ok. At least I’m not doing something wrong.

To answer your question regarding why I don’t just have the person’s name be a separate field… well, the site isn’t structured like that. I’m just using 1 body field and having them put different kinds of materials inside that. In this case, it’s a list of faculty short bios. On the About Us page, it’s just text, on the curriculum page, there is an explanation of the curriculum....etc. I try and keep the formatting required of them to simple, simple tags like bold tags here and there. line breaks etc… for the rest of the page I use embedded itms… so they are not editing the middle section, where the text goes.

I’m open to suggestions....

Profile
 
 
Posted: 23 May 2008 01:12 PM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  46
Joined  2007-09-10

Oh, yeah. I’m hoping 2.0 just has a SAEF for edit as well as entry.... The ability to edit in a stand alone form really, really unleashes the power of EE as a CMS, I think.

Profile
 
 
Posted: 26 May 2008 06:00 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Yeah, to be completely honest, I’d be pretty disappointed if EE 2.0 still relies on a 3rd party developer for basic functionality like this. wink

The only other suggestion would be to try adding in an Editor like TinyMCE, etc…
I’ve heard that solves a lot of problems smile

 Signature 
Profile