HTMLTextArea Misbehaving!

I've added a Profile Field in the builder to allow my members to enter the URL to their website.  As most people know, this often causes problems for people entering URL's but at the moment I'm still in testing so I can live with it for now.

BUT, I've NOT set the field to be Mandatory, yet when you try to save the profile, it says it is.

Also when I go back to edit the properties of the field in the builder, and go to edit the properties, the second page is showing attributes that are not relevant for that type of field.

It's showing the properties for Dropdown Menus, which are of course nothing to do with the HTMLTextArea field.

Has anyone else had a problem like this, and if so found a resolution?

Or... found a way to have a link in the profile fields? (someone had mentioned a mod for this but I've not found it yet) 

Quote · 11 Aug 2010

You can try this...

A)
Builders => Profile Fields

1)
- Join Form

Add a new Item

System Name: Website
Caption: Website
Description: Add your website, without this http://
Type: Text

SAVE IT

2)
- Edit Profile

Move Item Website from Inactive Items and drop it below Active Items (do it for Owner and Admin)

click on Item Website and edit
Caption: Website

SAVE IT

3)
- View Profile

Move Item Website from Inactive Items and drop it below Active Items (do it for Admin, Member and Visitor)

click on Item Website and edit
Caption: Website

SAVE IT

B)
open file inc/classes/BxDolProfileFields.php and find function getViewableValue( $aItem, $sValue ) {
Added code is bold

function getViewableValue( $aItem, $sValue ) {
switch( $aItem['Type'] ) {
case 'text':
switch( $aItem['Name'] ) {
case 'Website':
return nl2br( '<a href="http://' . $sValue . '" target="_blank">' . $sValue . '</a>' );
default:
return $sValue;
}
break;
case 'num':

Item name to links is Website inside Fields builder (Type: need to be text),
members need to write web adresse without this http://

Quote · 11 Aug 2010

OKweb - thank you for the detailed reply.

Unfortunately, I'm off out to work in a minute so I'll have to wait till tonight to try this out.  I will feed back to you how I get on!

Many thanks for the effort of such a good set of instructions.

Quote · 12 Aug 2010

Looks like I've not done something right:

I copied and pasted the code incase I made any errors but I'm getting something wrong (shown in the attachment I've uploaded) in the Website field.

I get a first link which doesn't work (it's garbage), though displayed correctly. I get the text for "target=" _blank" and a duplicate link.  This second link works fine though!

Capture.PNG · 3.5K · 304 views
Quote · 12 Aug 2010

System Name: Website
Caption: Website
Description: Add your website, without this http://
Type: Text

You can't use HTMLTextArea or TextArea

If you will have more than one website url you need to add a new item for each website,

Website
Website2
Website3
etc

Quote · 12 Aug 2010

Hi OKWeb,

I have only entered one URL in the field.

Something about the code is generating two URLs:  The first one is garbled, and the second one works!  The field is displayed like this:

 

Website: http://www.different-light.com/   "target="_blank"> http://www.different-light.com/
Quote · 12 Aug 2010

Can you post your code inside the function getViewableValue( $aItem, $sValue )

Quote · 12 Aug 2010

Hopefully this displays correctly.

 

switch( $aItem['Type'] ) {

case 'text':

switch( $aItem['Name'] ) {

case 'Website':

return nl2br( '<a href="http://'.$sValue.'"target="_blank">'.$sValue.'</a>' );

default:

return $sValue;

}

break;

case 'num':

case 'area':

return nl2br(htmlspecialchars_adv($sValue));

 

case 'html_area':

return $sValue;

 

case 'date':

return $this -> getViewableDate( $sValue );

 

case 'range':

return htmlspecialchars_adv( str_replace( ',', ' - ',$sValue ) );

 

case 'bool':

return _t( $sValue ? '_Yes' : '_No' );

 

case 'select_one':

$sValueView = $this -> getViewableSelectOne( $aItem['Values'], $sValue );

 

if ($aItem['Name'] == 'Country') {

$sFlagName = strtolower($sValue);

$sValueView = '<img src="' . $site['flags']  . $sFlagName . '.gif" /> ' . $sValueView;

}

 

return $sValueView;

 

case 'select_set':

return $this -> getViewableSelectSet( $aItem['Values'], $sValue );

 

 

case 'system':

switch( $aItem['Name'] ) {

case 'Age':

return age($sValue);

 

case 'DateReg':

case 'DateLastEdit':

case 'DateLastLogin':

return $this -> getViewableDate( $sValue );

 

case 'Status':

return _t( "_$sValue" );

 

case 'ID':

return $sValue;

 

case 'Featured':

return _t( $sValue ? '_Yes' : '_No' );

 

default:

return '&nbsp;';

}

break;

 

case 'pass':

default:

return '&nbsp;';

}

}

Quote · 12 Aug 2010

try and replace this line, must be a blank fields before and after the dot in the code, can't see anything else that is wrong right now...

return nl2br( '<a href="http://' . $sValue . '" target="_blank">' . $sValue . '</a>' );

 


which version do you use??

Quote · 12 Aug 2010

I've tried that and it doesn't seem to be working even after the change. :(

I'm using 7.0.2.

Quote · 12 Aug 2010

Tested and it works well in Dol. 7.0.1 and 7.0.2,

check what you have done in the Fields Builder...

Quote · 12 Aug 2010

Thanks for persevering with this OKWeb.

 

I've deleted my field in the profile builder and restarted the process from scratch.   It's working now! I don't know what I did wrong but I went through the steps exactly the same from what I can see.

Still - it now works - a great many thanks to you for helping me out with this one.  It's really appreciated.

Quote · 12 Aug 2010

Works great! Thanks okweb :)

Quote · 30 Mar 2012

I wish to add a website field in profile fields, where user inputs their "url"?

Which one is correct to use htmltextarea or text?

Quote · 30 Jan 2019

Hello 

Yes, you need to use htmltextarea, but is much better for users to post their sites directly in the Sites module.

Quote · 30 Jan 2019

 

Hello 

Yes, you need to use htmltextarea, but is much better for users to post their sites directly in the Sites module.

 Thank you.

Quote · 31 Jan 2019
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.