URL problems on edit
Posted: 01 July 2008 06:12 AM   [ Ignore ]
Newbie
Rank
Total Posts:  11
Joined  2008-06-26

Folks:

I’m not sure why this is happening. One of the custom fields holds a web address. This address is automatically turned into a link.

When I use Form Helper to edit the address the address is not displayed. Instead,

<a href=

appears in the field and the rest of the address and closing tag

http://www.google.com" />

appear below the field as text.

Source code looks like this:

<input style="width:500px" type="text" name="field_id_6" value="<a href="http://www.google.com">http://www.google.com</a>" />

Form Helper code looks like this:

{exp:form_helper:field_parser}<input style="width:500px" type="text" name="{exp:form_helper:field_grabber field_name="website"}" value="{website}" />{/exp:form_helper:field_parser}

Any ideas?

Profile
 
 
Posted: 01 July 2008 07:32 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

I’ve always just turned off the auto-linking preference for the given weblog. It’s always annoyed me.

mk

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 01 July 2008 09:01 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  11
Joined  2008-06-26

Thanks MK. Not sure if that’s an option, though. Most using the site won’t know how to create the link manually.

Any other possibilities?

Profile
 
 
Posted: 01 July 2008 02:34 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

wonko,

You’re only option for now, might be using something like TinyMCE. It seems to solve alot of these parsing issues smile

 Signature 
Profile
 
 
Posted: 01 July 2008 08:36 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  11
Joined  2008-06-26

Pie Man:

Thanks for that. I might try adding the link after the text link before going this route. For example, instead of allowing URL conversion in the actual post, grab the custom field string and somehow convert that to a URL. This way, Form Helper will display the string to be edited.

This doesn’t seem to work but I’ll post in the EE forums to see what shakes out.

Thanks again.

Profile
 
 
Posted: 01 July 2008 10:15 PM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  11
Joined  2008-06-26

Folks:

OK. I got this working thanks to this post:

http://expressionengine.com/forums/viewthread/38927/

Not the most elegant solution but it works.

Maybe the next version of Form Helper can sort this out?

Thanks!

Profile
 
 
Posted: 02 July 2008 05:09 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  11
Joined  2008-06-26

I did a little more digging and have a solution that should benefit others.

The problem:

Form Helper does not properly display URLs or email addresses when “Automatically turn URLs and email addresses into links?” in Admin > Weblog Management > Weblog Posting Preferences is set to Yes.

The solution:

Set “Automatically turn URLs and email addresses into links?” to No.
Install the Auto Linker plugin.
Install the HTML Strip plugin.
In your template, add the Auto Linker tags to the website address that needs to be hyperlinked like this:

{exp:auto_linker}{website}{/exp:auto_linker}

For whatever reason, the email address ignores the Auto Linker tag so you have to hard code the email address and use HTML Strip in your template like this:

<a href="mailto:{exp:html_strip}{email_address}{/exp:html_strip}">{email_address}</a>

In your template, set the email address and website fields to display as textareas. It does not seem to matter if the custom field in EE is set to Text Input or Textarea. Just be sure the template sets the field to be a textarea. The template code will look something like this:

<textarea name="{exp:form_helper:field_grabber field_name="email_address"}" cols="60" rows="1" />
{exp:form_helper:field_parser}{email_address}{/exp:form_helper:field_parser}</textarea>

And that’s it.

Some drawbacks:

Users can add more than one email or web address to the textarea.
It doesn’t look as nice as a Text Input box.
The mailto link is hanging out there just waiting for spammers to grab it.

Hope that helps others avoid some grief.

Profile
 
 
Posted: 02 July 2008 08:31 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Nice work wonko! Thanks smile

 Signature 
Profile
 
 
Posted: 07 September 2008 05:01 AM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  3
Joined  2008-08-05

I was working on this also - here’s another possible solution using jquery:

<p>Email Address<br/>
<
span class="js_email">{Jobs_email}</span>
<
input type="text" name="{exp:form_helper:field_grabber field_name="Jobs_email"}"
value=""/><br/>
</
p>

you probably want the style .js_email {display:none} to hide it
then using some jquery code

$(".js_email").each(function(){
$(this).next().val($(this).children("a").text());
  
})

If you’ll have a different structure/order of html, you’ll probably need to change the jquery code

but it works for me.

Cheers,
Yehosef

Profile
 
 
Posted: 07 September 2008 05:46 AM   [ Ignore ]   [ # 9 ]
Newbie
Rank
Total Posts:  3
Joined  2008-08-05

incidentally - this also works for urls - perhaps the class should be js_links ..?

Profile