raknuth
Posts: 67
|
| Posted: 04/03/2011, 12:19 PM |
|
Hi. I have built a form to store values to be used as CSS styling elements (width, height, font-family, font-size, etc). Some of these values are entered into textboxes and some of these values are selected from listboxes.
Example1: title_font_color is a value entered into a textbox as follows: #000000.
Example2: title_font_family is a value selected form a list of 8 common font families.
I created a series of nested <div> containers adjacent to the form. This structure acts as a live preview of the web page that will be styled with these CSS values. I populated this structure with dummy tex, and then 'styled' this dummy text with values from the form, as follows:
<div id="pageTitle">
<p class="color: {title_font_color}; font-family: {title_font_family}"></p>
</div>
It almost works. When published, the value entered into textbox (the color) presents a value in the live preview and is rendered properly. However, the value selected from the listbox (the font-family) is empty - the default theme font is used.
Please advise. Thank you.
|
 |
 |
damian
Posts: 838
|
| Posted: 04/03/2011, 3:21 PM |
|
what is your code to retrieve and set the value?
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
raknuth
Posts: 67
|
| Posted: 04/03/2011, 5:09 PM |
|
That is the point at which I am stuck. I did not have to create any additional code to use the value from the title_font_color textbox. I simply echoed the value of that field, as you can see in the code above. However, when I echo the value from the title_font_family listbox, an empty value is returned.
The listbox control is working correctly. I can confirm this in the data and subsequent form refreshes.
|
 |
 |
damian
Posts: 838
|
| Posted: 04/03/2011, 6:16 PM |
|
you do something like this:
in your preview field create a label called: myFont and add before show custom code event:
this is a sample/example - you will need to get it to work for you:
$Component->SetValue($Container->OriginalFieldName->GetValue());
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
Waspman
Posts: 948
|
| Posted: 04/04/2011, 12:45 AM |
|
Shouldn't it be style=
I've done this with free text fields and dropdowns and the content added is always inline.
If you're writing some CSS to be recalled on loading the page then that would be different and you would use id or class.
I don't know how you're structuring the page, but I would just stick the preview in an iframe, save the record and refresh the iframe calling the new attributes. If your components are saved as a CSS script then you simply call it on the preview page load.
_________________
http://www.waspmedia.co.uk |
 |
 |
jjrjr2
Posts: 131
|
| Posted: 04/04/2011, 6:57 AM |
|
Hi
What is the Bound Value for your listbox????
It needs to be a valid font name
Then in your before show event
$Container->textboxcontrolfontname->SetValue($Container->listboxcontrolname->GetValue());
Should work
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
Real Web Development At: http://RealWebDevelopment.us |
 |
 |
raknuth
Posts: 67
|
| Posted: 04/04/2011, 8:53 AM |
|
Damian, I attemped your suggestion it worked. It also leads me in the direction of a solution to two other problems with another application. Thank you.
And thanks to waspman and jjrjr2 for your contribution.
|
 |
 |