How do you create a pop up with a field option

This is a question to any kind action developer who can help me.
This may sound really simple but I don’t know how to create an actions that allows a pop-up but also a text field for the same area
eg

action-popup name=“which example”

value name=“example1” /

value name=“example2” /

value-text name=" " /

Does this make sense to anyone? I am trying to give a drop down of options 1,2 or other and the other is a field, so I can type in some text into it.

I suppose the other way is to have a: pop-up, or a field option, but I know I cant have the same name or parameter in a single action, so I am stuck with that option too.

Thank you in advanced to anyone who can help
and sorry with the non tekkie language,
pems :slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ah, the lovely combobox! I wish there was a native control for this
in the Actions API.

Try doing this in a fwInterface() function. What you want to do is
check to see if the field has been set to some dummy value like value
name=“addField” title = “Other…”

If it is, then hide the picker and show a text field. Put the text
field in right after the picker, and set its visibility to match
whether the picker is hidden or if the picker is set to addField.

You may also have to look at this from a fwParameterChanged (not sure
of the syntax, don’t have my manual open at the moment) perspective
to watch the field more closely. I think that fwInterface only runs
every time the Action palette gains focus.

In the function where you are consuming this variable, you will need
to do some conditional checking to get the proper value:

if(fwParameters['myPicker'].fwVisible and fwParameters 

[‘myPicker’].fwValue != ‘addField’){
//use this value
}else{
//use the text field, if it is visible and non-null
}

Walter

On Mar 6, 2008, at 3:19 PM, pems wrote:

This is a question to any kind action developer who can help me.
This may sound really simple but I don’t know how to create an
actions that allows a pop-up but also a text field for the same area
eg

action-popup name=“which example”

value name=“example1” /

value name=“example2” /

value-text name=" " /

Does this make sense to anyone? I am trying to give a drop down of
options 1,2 or other and the other is a field, so I can type in
some text into it.

I suppose the other way is to have a: pop-up, or a field option,
but I know I cant have the same name or parameter in a single
action, so I am stuck with that option too.

Thank you in advanced to anyone who can help
and sorry with the non tekkie language,
pems :slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you very much
I didn’t think it was going to be a straight forward thing.

I better get my head down and start to make some examples to see if I can do it

pems


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I know this sounds like a really stupid question and you have to keep in mind, I am just starting out using the more advanced actions. I naively thought it would be just like simple actions but with more advanced features. ( as you will be able to tell I am a fan of the simple actions especially as I have managed to make them work).

What I am finding after reading through lots of the downloaded more advanced reference material, is that some of the things I would like to do is really, really hard compared to doing them in simple basic actions, which doesn’t make sense to me at all.

This is just one example which I cant find an easy answer to. I want to create an action which I insert into my freeway document. I want to be able to get the dimensions of this action which is inserted / drawn onto the freeway page and then pass this to some very simple code like this:
so in my example I have a pop-up:

  1. action-popup name=“SizeW” >

  2. value name=“&_width;” default>

  3. value name=“100” />

  4. /action-popup>

  5. <? (this is my bit of code, &SizeW;, next part of code) ?>

In this scenario I would be present with a pop up in the action window and if I chose “&_width;” freeway would use the size I had drawn in the document and if I chose 100 it would use the width of 100 on publish.
Now I have found this to be easy and simple to understand I create the action interface parts and then those parts pass the information over to the code.

But as you can see from my original posting, I wanted to choose a couple of predetermined sizes or give my self the opportunity to type a size of my choosing in a field. So after Waltd kindly replied to what I hoped would be an easy answer to what sounded like a not too big a question, I thought ok I can’t kid myself with the fact that using the simple actions system is going to be able to give me what I need.

So for the last few days I have really tried to understand the basics on how the javascript action functions within freeway, and this is what seems really odd to me. In the simple action I had two areas to think about the action window and the code:
So in my original example I created the action window elements like the drop down and then using the “&” pass that information to the code, thats it… very simple.
But in the Javascript actions, as far as I can see this isnt that case, again in my original example how do you get the size of the item you have drawn into the action code because all I get is either null or &_width.
Do I really have to fwfind everything just to pass something across?

I know this will probably sounds daft and I am sure some people are going to say get a book and learn, but its not that easy there none about freeway actions.
I have joined a few general forums on javascript and all I get back from people is something that is either way over my head or remarks that basically make me feel like I shouldn’t even have joined thje forum and when I mention some of the javascript coding I need to understand is a freeway variation I get absolutely no help what so ever.
So at the moment I am having to go back to the simple basic actions as they seem to be much easier to understand and use, but I know this to be going backwards with no chance of progressing.

So finally after a very frustrating time (I feel like pulling my hair out) I am asking the general question to all the helpful freeway action developers is there any where I can learn how to understand just the basics on freeway specific javascript action writing. I know the reference manual has been written but it hasnt been much help for me though the Basic actions pdf written with contributions from Tim Plumb did get me part of the way along what seems like a very difficult road. I cant be the only one that has had these difficulties… :frowning:

After all this pent-up frustration how do you pass the size over to the code??


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

To get the size of the item, just get a reference to the item and get its height and width.

 var myItem = fwDocument.fwTags.fwFind(fwItem);
 Height = myItem.height;

walter


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Pems

Reading through your email, your frustrations sounded like a lot more than just not knowing how do this or that. So with that in mind I thought I would write as detailed an answer/reply that I could.

I do understand about trying to find a decent relevant manual or tutorial information on how to start to write actions using Freeway,s JavaScript… Especially as there is quite a good one from Tim about writing basic actions. There is Unfortunately no specific newbie documentation that I know about… Unless anybody else knows different, on Advanced action writing

The JavaScript reference manual that you can download is more an “engineers notes” rather than a “lets start from the beginning” and unfortunately most of the questions being asked and answered in this section are of an advanced nature. Updating the documentation available for developers is one area that I and a few other’s have been banging on about, as you have noted, there are quite a few documents that you can download but they are mainly for more advanced action developers. A lot of these a little old and a and quite a lots of the docs are from the freeway 3 period.

So to try and guide you into the write direction of how to start off, I would do a few things in your place
First buy a really good book like “JavaScript in easy steps”
It’s written in plain English is fully illustrated and is in colour which makes a massive difference. Don’t be tempted to get the more advanced books. It just wont make any sense. Other developers may have some better suggestions on books.
Next print out all the downloadable documentation from the knowledge database and print it out… If you are trying to learn, then reading the information is so much easier to understand than flicking form pdf to editor.

Next take tiny, tiny steps first. Try to recreate each example in the “JavaScript easy steps” manual and once you have succeeded then try to adapt the code so it becomes freeway JavaScript code (its basically putting fw in front of a load of words.

Another thing to think about is use of a good text editor. I use TextMate as its colour codes different parts of the script which makes things easier to find. But again other developers may suggest other editors.

Next is if you have managed to get your head around simple actions then try to recreate these in the more advanced scripting language.

Things to think about: As you have discovered basic actions are superb for dumping bits of script into your freeway document but basic actions don’t allow much in the way of document interrogations. This is why you do sometimes need to use the more advanced action system. This is a great thing but comes with a lot more headaches, one being that the scripting is going to be in general a lot longer, as there are different areas you will need to code for, like the fwinterface which you would have no comparison in basic actions to draw any experience from. Its also one area that the book “JavaScript in easy steps” has no relevant comparison to read, so again Other people may suggest other books that may have something better, for this area.

I hope in the near future there is going to be a big overhaul on the documentation for action writing as it’s one area that is inevitably left behind and is well overdue, but in the mean time please keep asking questions and I am sure people will help you.

I don’t know if any body else has any other suggestions or comments for people just starting out, but I would expect anything would be welcome.

Kindest regards and try to keep sane.
max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I have just re-read my post and thought I had better apologise in advance for the appalling grammar and punctuation… ooops
max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

To toss in another viewpoint, and strictly focusing on the back-end programming:

It sounds as though pems is trying to get the fwParameter value into the outputted code. &NAME syntax is used inside blocks of markup code like: < action-markup includeoncebeforehead >. And, even then, I think it is for specific tags, like &title, &time, &date, etc… (I’ve not ever used these, so I forget the actual syntax for them. Softpress uses these a lot in their example actions)

To include a fwParameter anywhere else, it means actually ‘creating’ and ‘manipulating’ a string. Instead of a block of < markup > (using &NAME), you need to actually do something like the following within the action-javascript:

var jsCode = ‘myGreatJSFunctionThatIWantInThePage(’ + fwParameters[‘myParam’].fwValue + ‘){ the code that follows my variable;}’

Of course, this string method works anytime you want to ‘mix’ text with values from action parameters.

-OR-

A different method would involve actually doing a text search/replace in a block of text. Instead of ‘my code &NAME;’, you could use something like ‘my code NAME’. Then doing a JS string.replace(‘NAME’,fwParameters[‘NAME’].fwValue).

This method (slightly changed to use regex instead) works quite well for large blocks of text that may have multiple instances of a value you want to change.

As a side point, both this methods involve YOU injecting the code into the fwDocument with things like ‘somePosition.fwAddRaw(myString)’; neither method relies on the initially mentioned < includeoncebeforehead > shortcut attached to most < action-markup > items. This injection is a whole other subject than the string/param value mixing.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I was looking at this over the weekend and spent ages trying to
remember how to write simple (non JavaScript) actions. I used to be
able to create these in my sleep and had almost forgotten how to
write them. I’ve created two actions, one simple and one JavaScript
based that should do the same thing.
You can find them both here;
http://www.freewayactions.com/code/
Take a look at the code and feel free to ask any questions about how
they function.
Regards,
Tim.

PS. The second (JavaScript) action is almost certainly incorrect when
it comes to getting the text field size but couldn’t find the correct
part of the documentation to look it up.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hello Weaver, Waltd, Tim and Max.

Sorry I haven’t replied very quickly, but after I struggled in trying to convert the knowledge I have, and then failing to incorporate the very kind answers, I thought I better take a day off to recompose my self.

I know the real issue is: I don’t know enough about writing JavaScript to understand what most of the answers have meant. So after reading all your emails, I am off to Amazon to buy the best book I can find.
Apart from the one Max suggested, does any one else have a good book in there own libraries that they would recommend getting for some one in my position?

Thank you Tim for the example you have written. The first example does at least feel like I am on familiar ground and it does give me the opportunity to view dissect and eventually translate into a more advanced action, though I now suspect this may be some way off and I also suspect I may need to come back and ask some more silly questions.

Thank you everyone with your patients, suggestions and words of encouragement.

pems


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

http://www.w3schools.com is free and very very good for not only JS
but also HTML, XML, CSS and just about every other web technology you
can think of. There are also live examples that you can play around
with to see how things work.

Joe

On 11 Mar 2008, at 10:15, pems wrote:

Hello Weaver, Waltd, Tim and Max.

Sorry I haven’t replied very quickly, but after I struggled in
trying to convert the knowledge I have, and then failing to
incorporate the very kind answers, I thought I better take a day off
to recompose my self.

I know the real issue is: I don’t know enough about writing
JavaScript to understand what most of the answers have meant. So
after reading all your emails, I am off to Amazon to buy the best
book I can find.
Apart from the one Max suggested, does any one else have a good book
in there own libraries that they would recommend getting for some
one in my position?

Thank you Tim for the example you have written. The first example
does at least feel like I am on familiar ground and it does give me
the opportunity to view dissect and eventually translate into a more
advanced action, though I now suspect this may be some way off and I
also suspect I may need to come back and ask some more silly
questions.

Thank you everyone with your patients, suggestions and words of
encouragement.

pems


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I keep going back to JavaScript: The Complete Reference from
O’Reilly. If you want something more grounded in practical examples,
then The JavaScript Bible by Danny Goodman.

Walter

On Mar 11, 2008, at 6:15 AM, pems wrote:

Hello Weaver, Waltd, Tim and Max.

Sorry I haven’t replied very quickly, but after I struggled in
trying to convert the knowledge I have, and then failing to
incorporate the very kind answers, I thought I better take a day
off to recompose my self.

I know the real issue is: I don’t know enough about writing
JavaScript to understand what most of the answers have meant. So
after reading all your emails, I am off to Amazon to buy the best
book I can find.
Apart from the one Max suggested, does any one else have a good
book in there own libraries that they would recommend getting for
some one in my position?

Thank you Tim for the example you have written. The first example
does at least feel like I am on familiar ground and it does give me
the opportunity to view dissect and eventually translate into a
more advanced action, though I now suspect this may be some way off
and I also suspect I may need to come back and ask some more silly
questions.

Thank you everyone with your patients, suggestions and words of
encouragement.

pems


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 11 Mar. 2008, 1:31 pm, waltd wrote:

I keep going back to JavaScript: The Complete Reference from
O’Reilly.

That’s the one I use too. My version is years old, but still very applicable.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options