Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 10th, 2024, 7:30 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Value from the text field to the variable (html5)
PostPosted: February 9th, 2014, 7:27 pm 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
Hi, I have a text field with module version e.g. "1.0" on the Master page (text entered to the field "ModuleVersionTxt" when making changes in OpusPro). After exporting to HTML I'd like to read this value from the text field to the variable "var_module_id".
I know, I can store my value "1.0" as an initial value for a variable but it is easy to forget to change it before publishing.

Cheers,
Ota


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 12th, 2014, 6:23 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I think if you look at the HTML code, you'll see why this isn't practical.

But as an alternative, you could create a text box and call the box object something like version-1.x. Then using an onShow trigger and the following code:

Code:
ModuleVersionTxt = this.GetName()


The above would also work with a constant expression for on screen display.

Mack
https://twitter.com/imsmackavi

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 12th, 2014, 10:47 pm 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
It is a nice trick with this.GetName().

I went through the code and I think it should not be a problem to get a text once you know the object ID. I wrote a javascript script which determines if a text field is static or dynamic and then it returns a content. But it works only On Click action. If I use On Show action instead it does not see the method because my external script is not loaded yet (I use external .js because I use .replace(/^\s\s*/, '') for replacing white spaces in the text and this line is not exported from Opus.

Here is a simple version of the script which works On Show (text field must be dynamic) and can be placed in the Script on the object.
Code:
var objId = document.getElementById(this.m_elementId);
var objSpan = objId.getElementsByTagName("span")[0];
objTxt = objSpan.innerHTML;
var_module_version = objTxt;

Thank you for your help.
Ota


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 13th, 2014, 10:09 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Nice trick with the dynamic text switch :D

I think with an understanding like yours, you'd be better posting in the advanced or Evo section as the basic section assumes simpler non-scripted solutions rather than somebody whose already dabbling in the black arts :mrgreen:

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 13th, 2014, 11:00 am 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
I was hoping for simple solution :-o.
PS: should I (re)move it?


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 13th, 2014, 11:20 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
No. I'd leave it. Great heights and giant's shoulders being good for learning :-)

Do you understand OOP and what .this is?

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 13th, 2014, 3:08 pm 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
I used to develop in Flash and Flex using AS3. Now I work mostly with ASP.NET, HTML and javascript/jQuery. But I'm not the expert. Is it the answer to your question?

After reading your tweet about .this I started to understand it a bit more. btw development mode in Chrome is a great source of information :-).

Ota


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 13th, 2014, 4:52 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I was going post a tip about learning more about the methods for the different objects - but you gave me an idea - I tweeted it instead!

Mack
https://twitter.com/imsmackavi

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 14th, 2014, 9:25 am 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
Chrome and console.log rulez :-D. Now I understand what is the sequence of loading objects. Adding one more page for script initialization and scripts are working even On Show actions.
Short tweet but big progress for me.

Thanks.

Ota

PS: I'd still prefer to have a possibility for adding external .js (.css) via Opus menu rather than a script


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Value from the text field to the variable (html5)
PostPosted: February 14th, 2014, 2:18 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
PS: I'd still prefer to have a possibility for adding external .js (.css) via Opus menu rather than a script++

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group