Real POST/GET

97 views
Skip to first unread message

Steffen Panning

unread,
May 7, 2012, 4:02:26 PM5/7/12
to nitro...@googlegroups.com
Hi folks,

I like this framework but I need something that is not supported on purpose.
At least this is how it looks like.

I need a real form element and a real post or get.
I have a reason for that: I think the basic operations on a
website should work without javascript. The javascript is for the fancy stuff.
Look at google search. You can still use it without javascript.
If you have javascript activated it is way more comfortable,
but if not it still works.

So here is my question:
* Is there a good reason not to apply a 'real' id attribute to the
input elements?
* Is there a good reason not to add a form element?
* Is there a good reason not to add a real 'submit button'?

I think these extensions are added quite easily,
but I wonder if such a change has a
chance to make it into the main branch.

Thanks for suggestions

Steffen

Jesse Gumm

unread,
May 7, 2012, 7:06:59 PM5/7/12
to nitro...@googlegroups.com
Hi Steffen,

As you've noted, Nitrogen is very much a javascript heavy framework,
but it is possible to operate a bit RESTfully. wf:q/1 does retrieve
both POST and GET variables.

I can see the value in adding elements like a #rest_form, and
#rest_submit which would work like the related <form> and <input
type=submit> html elements.

As for the reason they haven't been added? It just hasn't been. I
haven't found a dire need in my operations, and obviously Rusty didn't
find it critical, so it just never happened. But if you wanted to
implement some restful elements, I certainly encourage it and will be
happy to bring in a pull request for it.

As for adding a real id attribute to the elements, this is something
that will be merged in soon, though it needs a bit of testing to
ensure nothing is majorly broken as a result of it. There's a pending
pull request for adding an html_id attribute to the elements
(https://github.com/nitrogen/nitrogen_core/pull/17), I just haven't
had a chance to get to testing it before bringing it in.

-Jesse
> --
> You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
> To post to this group, send email to nitro...@googlegroups.com.
> To unsubscribe from this group, send email to nitrogenweb...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nitrogenweb?hl=en.
>



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Jesse Gumm

unread,
May 7, 2012, 7:16:13 PM5/7/12
to nitro...@googlegroups.com
As far as what I think should be added for adding restful elements:

1) I'm undecided on the idea naming: #rest_form{}, #html_form{},
#form{} ? (I don't think I like #form{} despite it's succinctness,
just due to the implication of the others that this is indeed a normal
restful form, and not some special nitrogen construct.

2) #rest_submit{}, #html_submit{}l, #submit{}? (same arguments apply
above, though I'm less apprehensive about #submit{} as I am for
#form{}). Convince me :)

3) Either modifying #textbox, #password, etc to have either the
nitrogen id be emitted as the html name attribute, or add a 'name'
attribute to these elements. The latter, however, will begin to make
the naming of elements in nitrogen RATHER convoluted, since there will
be 'id' (the nitrogen ID), 'html_id' (the HTML ID), and then 'name'
(the name html attribute for forms). I think I prefer having the
nitrogen ID being emitted as the name of the form, but then the
inconsistency of having the HTML id being separated while the 'name'
not separated does not sit too well with me. I'll give this some
thought.

4) Validation: The validation is currently set to work with postbacks
and javascript, and not with standard submission. Reworking the
validation wiring would take some work. Something to consider.

So those are some thoughts that run through my head with this
proposal. I'm curious to hear what you and/or others would think
about this.

-Jesse

Steffen Panning

unread,
May 7, 2012, 11:03:41 PM5/7/12
to nitro...@googlegroups.com
On Tue, May 8, 2012 at 1:16 AM, Jesse Gumm <gu...@sigma-star.com> wrote:
> As far as what I think should be added for adding restful elements:
>
> 1) I'm undecided on the idea naming: #rest_form{}, #html_form{},
> #form{} ?  (I don't think I like #form{} despite it's succinctness,
> just due to the implication of the others that this is indeed a normal
> restful form, and not some special nitrogen construct.


I'm undecided here too.
We could call it #restful_action{} since this indicates the difference.
Newbees wouldn't use it by accident, because the name is not common.
If we call it #form{} there is a high probability that they'll get disturbed,
because if such an element exists they probably expect that there
must be a form element around the input elements.

>
> 2) #rest_submit{}, #html_submit{}l, #submit{}? (same arguments apply
> above, though I'm less apprehensive about #submit{} as I am for
> #form{}).  Convince me :)
>

#submit is IMO ok.

> 3) Either modifying #textbox, #password, etc to have either the
> nitrogen id be emitted as the html name attribute, or add a 'name'
> attribute to these elements.  The latter, however, will begin to make
> the naming of elements in nitrogen RATHER convoluted, since there will
> be 'id' (the nitrogen ID), 'html_id' (the HTML ID), and then 'name'
> (the name html attribute for forms).  I think I prefer having the
> nitrogen ID being emitted as the name of the form, but then the
> inconsistency of having the HTML id being separated while the 'name'
> not separated does not sit too well with me.  I'll give this some
> thought.

We could do it magically, if it doesn' break things.
The name attribute is only needed within a #restful_action/#html_form.
so the render_functions may notice that and add name=NitrogenID
to every input element.
>

> 4) Validation: The validation is currently set to work with postbacks
> and javascript, and not with standard submission.  Reworking the
> validation wiring would take some work.  Something to consider.

Nothing I have thought of yet

Steffen

Steffen Panning

unread,
May 8, 2012, 6:14:15 PM5/8/12
to nitro...@googlegroups.com
>> I think I prefer having the
>> nitrogen ID being emitted as the name of the form, but then the
>> inconsistency of having the HTML id being separated while the 'name'
>> not separated does not sit too well with me.  I'll give this some
>> thought.

There is another option. the 'id' is the same as the 'html_id' and
the ''name'. The User of the framework can only set the id. In this
scenario the API does not change at all. There are only internal
changes. If you hack the internal stuff it may gets a little more
complicated, but as an user of the framework you don't recognize this.

Steffen

Steffen Panning

unread,
May 9, 2012, 4:12:11 PM5/9/12
to nitro...@googlegroups.com
Hi Jesse,
Just a fast update:
I've written a little script to inject elements (e.g name, html_id)
into the render_element|wf:tags_emit function call of each element.
Since don't have an git-hub account yet and not much expirience with
git, the push to git has to wait until saturday or sunday.

Steffen
--
Demokratie
das ist, wenn 2 Wölfe und ein Schaf über die nächste Mahlzeit abstimmen

Freiheit
das ist, wenn das Schaf bewaffnet ist und die Abstimmung anficht
(Benjamin Franklin)

Jesse Gumm

unread,
May 10, 2012, 4:01:21 AM5/10/12
to nitro...@googlegroups.com

Hi Steffan,

Well, we certainly don't need name attributes for every element, just form elements.

And like I said, the html_id part is pretty much done already.

I think it round be relatively easy to update the elements of a restful form to automatically set the name attribute.

I think the proper default would be not to emit name with every element, and have restful form update its elements to use the id, unless the restful name is already set (overwriting).

-Jesse

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866

www.sigma-star.com
@jessegumm

Steffen Panning

unread,
May 10, 2012, 6:46:28 AM5/10/12
to nitro...@googlegroups.com
> Well, we certainly don't need name attributes for every element, just form
> elements.

Of course

>
> And like I said, the html_id part is pretty much done already.
>
> I think it round be relatively easy to update the elements of a restful form
> to automatically set the name attribute.
>
> I think the proper default would be not to emit name with every element, and
> have restful form update its elements to use the id, unless the restful name
> is already set (overwriting).
>

ok, so is there something i can do to help you?
Or will the talking overhead be more time consuming
than programming the stuff by yourself? ;)

Steffen

Jesse Gumm

unread,
May 10, 2012, 1:53:02 PM5/10/12
to nitro...@googlegroups.com
Hi Steffan,

> ok, so is there something i can do to help you?
> Or will the talking overhead be more time consuming
> than programming the stuff by yourself? ;)

If you wanted to make the restful_form element and the restful_submit
elements, and then have element_restful_form:render_element do a deep
search of the body to update pertinent form elements (#textbox,
#hidden, #dropdown, etc), and automatically set the name attribute
based on a handful of rules like if "restful_name==undefined, set name
to id".

BTW, I think I like the terms #restful_form [1], #restful_submit, and
the nitrogen attribute being called restful_name (instead of just
name, to avoid confusion). That makes it all very deliberate.

Feel free to go for it. How does that sound?

[1] As opposed to restful_action, as "action" already has a pretty
specific meaning in nitrogen, I think it would lead to confusion.

-Jesse

>
> Steffen
>
> --
> You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
> To post to this group, send email to nitro...@googlegroups.com.
> To unsubscribe from this group, send email to nitrogenweb...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nitrogenweb?hl=en.
>



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Steffen Panning

unread,
May 10, 2012, 3:57:54 PM5/10/12
to nitro...@googlegroups.com
Hi Jesse,
that sounds good.
I hope I have time for that at the weekend.

> BTW, I think I like the terms #restful_form [1], #restful_submit, and
> the nitrogen attribute being called restful_name (instead of just
> name, to avoid confusion).  That makes it all very deliberate.

That's fine by me.

Steffen

Jesse Gumm

unread,
May 10, 2012, 4:00:42 PM5/10/12
to nitro...@googlegroups.com

Great!

I'm looking forward to seeing what you put together.

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866

www.sigma-star.com
@jessegumm

Reply all
Reply to author
Forward
0 new messages