ActionsDev

7 replies to this thread. Most Recent

Ian Webb

1 Mar 2017, 4:33 pm

[Pro] Adding a class to a generated tag

Hi!

A want to write an action that generates a form tag to wrap around a div.

So, I’ve created an item-action, and used fwAddEnclosing(“form”, true).

So far so good. I can set the Name, Action, ID, Method, etc., but, for the life of me, I can’t get it so set the class.

I thought this would work: formTag.class = fwQuote(fwParameters[“Form Class”].fwValue);

But Freeway kicks out an interpreter error: ‘missing name after . operator’. I’ve checked, and it’s the .class that it doesn’t like. If I set it to ‘.className =’ it works (but the attribute className is no use to me).

Can anyone point me in the right direction please?

Cheers, Ian.

Tim Plumb

1 Mar 2017, 7:42 pm

Tim Plumb - Experienced Freeway designer for hire

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro

FreewayStyle.com - Free Freeway templates and parts to download, use and explore

Ian Webb

1 Mar 2017, 8:36 pm

Hi Tim!

I can’t see any content in your post - was there any?

Cheers, Ian

Tim Plumb

1 Mar 2017, 9:11 pm

Hi Ian, I’m not sure why that didn’t show up on FW Talk. Anyway hopefully here it is again…

Yes this is one of those things that trips everyone up.

Try:

formTag[“class”] = fwQuote(fwParameters[“Form Class”].fwValue);

Regards, Tim.

On 1 Mar 2017, at 20:36, Ian Webb <[email protected]> wrote:

Hi Tim!

I can’t see any content in your post - was there any?

Cheers, Ian

Tim Plumb - Experienced Freeway designer for hire

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro

FreewayStyle.com - Free Freeway templates and parts to download, use and explore

waltd

1 Mar 2017, 11:09 pm

Class is a reserved word, so you have to use the alternate (square bracket) syntax to set it. Try formTag['class'] = fwQuote(fwParameters["Form Class"].fwValue);

Walter

On Mar 1, 2017, at 11:33 AM, Ian Webb <[email protected]> wrote:

Hi!

A want to write an action that generates a form tag to wrap around a div.

So, I’ve created an item-action, and used fwAddEnclosing(“form”, true).

So far so good. I can set the Name, Action, ID, Method, etc., but, for the life of me, I can’t get it so set the class.

I thought this would work: formTag.class = fwQuote(fwParameters[“Form Class”].fwValue);

But Freeway kicks out an interpreter error: ‘missing name after . operator’. I’ve checked, and it’s the .class that it doesn’t like. If I set it to ‘.className =’ it works (but the attribute className is no use to me).

Can anyone point me in the right direction please?

Cheers, Ian.

Freeway user since 1997

http://www.walterdavisstudio.com

Ian Webb

2 Mar 2017, 9:41 am

Hi Tim and Walter!

Thanks for this. I was nearly there - I’d left the ‘.’ in before [‘class’].

I’ve posted the action to Actionsforge now: http://www.actionsforge.com/actions/form-in-div-table

Thanks again both.

Cheers, Ian.

waltd

2 Mar 2017, 1:32 pm

This looks excellent. Minor word-geek complaint — the word you want is deprecated (no longer in common use) rather than depreciated (lost some of its value).

Walter

On Mar 2, 2017, at 4:41 AM, Ian Webb <[email protected]> wrote:

Hi Tim and Walter!

Thanks for this. I was nearly there - I’d left the ‘.’ in before [‘class’].

I’ve posted the action to Actionsforge now: http://www.actionsforge.com/actions/form-in-div-table

Thanks again both.

Cheers, Ian.

Freeway user since 1997

http://www.walterdavisstudio.com

Back to Top

Ian Webb

2 Mar 2017, 2:24 pm

Minor word-geek complaint — the word you want is deprecated (no longer in common use) rather than depreciated (lost some of its value).

Thanks Walter - I dread to think of the number of times I must have misused depreciated over the years!

Still, you live and you learn…

Cheers, Ian.