Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
display a field value as "default value" for a texbox field (admin side)

 

 


willbegood
User

Mar 13, 2010, 1:50 PM

Post #1 of 9 (1967 views)
Shortcut
display a field value as "default value" for a texbox field (admin side) Can't Post

Hello,

Let's say i have an editor "person"
Here are my fields that define "person"

name (text field)
age (text field)
description (text box)

I want to set for "descrition" as default value something like that :

"His name is $name and he is $age years old, please call this person"
I want this admin side, i know how to do it with a piece of PHP for a viewer page front side.

I've already tryed to put php code in the default value of my text area... without no result.

Can anybody help?


gkornbluth
Veteran

Mar 15, 2010, 3:54 AM

Post #2 of 9 (1953 views)
Shortcut
Re: [willbegood] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

Hi willbegood.

Could you describe what you mean by "Admin side"?

Where do you want to view this information?

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com


willbegood
User

Mar 15, 2010, 5:12 AM

Post #3 of 9 (1948 views)
Shortcut
Re: [gkornbluth] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

I mean inside cms builder


gkornbluth
Veteran

Mar 15, 2010, 5:27 AM

Post #4 of 9 (1947 views)
Shortcut
Re: [willbegood] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

sorry but I still don't understand

Jerry
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com


willbegood
User

Mar 15, 2010, 5:33 AM

Post #5 of 9 (1943 views)
Shortcut
Re: [gkornbluth] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

see attachment for what i'm trying to do
Attachments: Image 2.png (156 KB)


gkornbluth
Veteran

Mar 15, 2010, 8:17 AM

Post #6 of 9 (1938 views)
Shortcut
Re: [willbegood] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

Do the values that you want to display come from another table?

Jerry
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com


willbegood
User

Mar 15, 2010, 8:31 AM

Post #7 of 9 (1936 views)
Shortcut
Re: [gkornbluth] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

no from the same table. I suppose there is a particular syntax to use, but don't know which one.


Chris
Staff


Mar 15, 2010, 4:25 PM

Post #8 of 9 (1926 views)
Shortcut
Re: [willbegood] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

Hi willbegood,

I don't think PHP alone could solve this, since the name and age fields are on the same web page as the description field. I think the only way to solve this would be with some custom JavaScript which dynamically updates the text field.

A simple alternative might be to literally use "$name" and "$age" in your description field, then replace them on the front-end:


Code
<?php 
$record['description'] = str_replace('$name', $record['name'], $record['description']);
$record['description'] = str_replace('$age', $record['age'], $record['description']);
echo htmlspecialchars($record['description']);
?>


If you're set on having the textbox dynamically update, we could accomplish this via custom programming through our consulting service. Please let me know if you're interested in that.

I hope this helps. Please let me know if you have any questions.
Chris


gkornbluth
Veteran

Mar 16, 2010, 2:14 PM

Post #9 of 9 (1912 views)
Shortcut
Re: [chris] display a field value as "default value" for a texbox field (admin side) [In reply to] Can't Post

Chris,

Thanks for fielding this one.

Jerry
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com