AFAICT, there is no real use for <form></form> in Amber. I might as well create my own "forms" using form elements (formatted with <table></table>) and buttons, then validate the form in the Amber code. I say this because I haven't found any examples of forms handling in Amber and I can't imagine how to use <form></form> (which, I believe, is only good for POSTing between browser and web server).
-- If I'm on the wrong path, can someone point me in the right direction? You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Dear Richard, what you are asking is actually not related to Amber but about the semantics HTML. Since you used the word 'form' in quotes you basically want to have a form and not a table. To understand the difference you should read the following pages: Forms: Tables: Best, Manfred On Sun, May 31, 2015 at 10:23 PM, Richard Eng <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and labels on those controls. Users generally "complete" a form by modifying its controls (entering text, selecting menu items, etc.), before submitting the form to an agent for processing (e.g., to a Web server, to a mail server, etc.) The question is related to Amber in the sense that when you "submit the form," to what "agent" do you submit? After all, this is a client-side application; you are no longer relying on a web server for handling application logic. This is a single-page application (or SPA); you are no longer navigating to other webpages. You write your Amber application the same way you would write any other standalone (desktop) application, whether that be in C++ or Visual Basic or Pascal. From this standpoint, a HTML form is rather pointless, is it not? Maybe I'm missing something or misunderstanding the purpose of Amber. On Sunday, 31 May 2015 16:44:51 UTC-4, MKroehnert wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Jeremy
An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and labels on those controls. Users generally "complete" a form by modifying its controls (entering text, selecting menu items, etc.), before submitting the form to an agent for processing (e.g., to a Web server, to a mail server, etc.) The question is related to Amber in the sense that when you "submit the form," to what "agent" do you submit? After all, this is a client-side application; you are no longer relying on a web server for handling application logic. This is a single-page application (or SPA); you are no longer navigating to other webpages. You write your Amber application the same way you would write any other standalone (desktop) application, whether that be in C++ or Visual Basic or Pascal. From this standpoint, a HTML form is rather pointless, is it not? Maybe I'm missing something or misunderstanding the purpose of Amber. On Sunday, 31 May 2015 16:44:51 UTC-4, MKroehnert wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by horrido
Dear Richard,
-- On Mon, Jun 1, 2015 at 12:03 AM, Richard Eng <[hidden email]> wrote:
let's slow down a bit. No need to explain to me what a single page application is. I have been around in Amber land for quite some time. Your initial question was about what a form is used for and why not just use a table (with a side sentence about POSTing forms). So, a form is a _semantic_ HTML element for grouping inputs and table is a different element for showing data. This is about the _structure_ of an HTML document and has nothing to do with submitting anything to a server or not in the first place. You are also advised to group input elements inside form tags. The question is not Amber specific since you could ask the same question on the AngularJS mailinglist. Now, I once answered a question related to getting values from forms in Amber on SO. You might find this one useful: Best, Manfred
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Two things:
1. Form in HTML5 has such things as validation, required etc. Not entirely sure if standalone inputs are well with it, nevertheless, if grouped under one form, they make a group which must be correct as a whole for submit to happen. 2. Form has submit event which you can hook up to. So you could still make things the classical way, but what actually happen when submitting is up on your code (don't forget to preventDefault/stopPropagation/return false in that code for actual old-way submit not to happen). Manfred Kröhnert wrote: > Dear Richard, > > On Mon, Jun 1, 2015 at 12:03 AM, Richard Eng <[hidden email] > <mailto:[hidden email]>> wrote: > > An HTML form is a section of a document containing normal > content, markup, special elements called /controls/ > <http://www.w3.org/TR/html401/interact/forms.html#form-controls> (checkboxes, > radio buttons, menus, etc.), and labels on those controls. Users > generally "complete" a form by modifying its controls (entering > text, selecting menu items, etc.), before submitting the form to > an agent for processing (e.g., to a Web server, to a mail > server, etc.) > > > The question is related to Amber in the sense that when you "submit > the form," to what "agent" do you submit? After all, this is a > client-side application; you are no longer relying on a web server > for handling application logic. This is a single-page application > (or SPA); you are no longer navigating to other webpages. You write > your Amber application the same way you would write any other > standalone (desktop) application, whether that be in C++ or Visual > Basic or Pascal. From this standpoint, a HTML form is rather > pointless, is it not? > > Maybe I'm missing something or misunderstanding the purpose of Amber. > > > let's slow down a bit. > No need to explain to me what a single page application is. > I have been around in Amber land for quite some time. > > Your initial question was about what a form is used for and why not just > use a table (with a side sentence about POSTing forms). > So, a form is a _semantic_ HTML element for grouping inputs and table is > a different element for showing data. > This is about the _structure_ of an HTML document and has nothing to do > with submitting anything to a server or not in the first place. > You are also advised to group input elements inside form tags. > The question is not Amber specific since you could ask the same question > on the AngularJS mailinglist. > > Now, I once answered a question related to getting values from forms in > Amber on SO. > You might find this one useful: > http://stackoverflow.com/questions/27664859/how-do-i-get-the-values-of-all-the-fields-of-a-form > > Best, > Manfred > > On Sunday, 31 May 2015 16:44:51 UTC-4, MKroehnert wrote: > > Dear Richard, > > what you are asking is actually not related to Amber but about > the semantics HTML. > > Since you used the word 'form' in quotes you basically want to > have a form and not a table. > > To understand the difference you should read the following pages: > > Forms: > https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form > > http://www.w3.org/TR/html401/interact/forms.html > > Tables: > https://developer.mozilla.org/en/docs/Web/HTML/Element/table > > http://www.w3.org/TR/html401/struct/tables.html > > Best, > Manfred > > > > On Sun, May 31, 2015 at 10:23 PM, Richard Eng > <[hidden email]> wrote: > > AFAICT, there is no real use for <form></form> in Amber. I > might as well create my own "forms" using form elements > (formatted with <table></table>) and buttons, then validate > the form in the Amber code. I say this because I haven't > found any examples of forms handling in Amber and I can't > imagine how to use <form></form> (which, I believe, is only > good for POSTing between browser and web server). > > If I'm on the wrong path, can someone point me in the right > direction? > > > -- > You received this message because you are subscribed to the Google > Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [hidden email] > <mailto:[hidden email]>. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Manfred Kröhnert
Yes, your link is useful. However, I do have a question...
-- Your example assumes all input elements are of the same type ('text'). How can it be generalized for different input types? In particular, how would you specify one of the input elements as type 'password'? For example:
This is more of a Smalltalk question, but I confess I'm not a Smalltalk expert (haven't used it for over 8 years!). On Sunday, 31 May 2015 18:58:54 UTC-4, MKroehnert wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hi Richard,
-- you could use a dictionary for this, something (roughly) like: Dictonary new at: 'Password' put: 'password'; at: 'First name' put: 'text'; at: 'whatever' put: 'text'; yourself keysAndValuesDo: [:each | self renderInput: each key type: each value on: html ]. If you feel you're gonna need to specify more properties per input, you may want to build your own object to describe them. Hope it helps, Bernat. 2015-06-01 16:02 GMT+02:00 Richard Eng <[hidden email]>:
Bernat Romagosa.
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Herby Vojčík
I find that if you return false, it no longer performs HTML5 validation.
-- On Monday, 1 June 2015 09:06:16 UTC-4, Herby wrote: Two things: You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Richard Eng wrote: > I find that if you return false, it no longer performs HTML5 validation. Hm. Sad. > On Monday, 1 June 2015 09:06:16 UTC-4, Herby wrote: > > Two things: > > 1. Form in HTML5 has such things as validation, required etc. Not > entirely sure if standalone inputs are well with it, nevertheless, if > grouped under one form, they make a group which must be correct as a > whole for submit to happen. > > 2. Form has submit event which you can hook up to. So you could still > make things the classical way, but what actually happen when submitting > is up on your code (don't forget to > preventDefault/stopPropagation/return false in that code for actual > old-way submit not to happen). -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
I've learned a very important lesson from this Amber exercise. For all but the simplest HTML layouts, it is impractical to use Amber to generate forms. HTML5 is very complex and offers unbelievable flexibility in UI design (eg, size and maximum length of input, placeholder text, preselection for checkbox or radio, autofocus, autocomplete, etc.). If you have a complex interface, it's best to code your form in pure HTML; otherwise, you're constantly fighting with Amber.
-- Thus, when it comes time to process your form, you can resort to Amber, but that means duplicating some of the form definition in Amber, in particular, creating a dictionary of all the input fields you want to collect upon submission. More duplication is involved if you also want to do your own input validation (eg, required, pattern-matching, minimum/maximum value, etc.). On Tuesday, 2 June 2015 04:23:46 UTC-4, Herby wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Richard Eng wrote: > I've learned a very important lesson from this Amber exercise. For all > but the simplest HTML layouts, it is impractical to use Amber to > generate forms. HTML5 is very complex and offers unbelievable > flexibility in UI design (eg, size and maximum length of input, > placeholder text, preselection for checkbox or radio, autofocus, > autocomplete, etc.). If you have a complex interface, it's best to All those things are attributes. It is not hard to add them in Amber Web (at:put:), and it is even easier to add them in Silk (just put an inline #{'key'->'value'...} object into HTML stream. Have you tried Silk for different approach to generate DOM content (saying 'HTML' is not accurate). > code your form in pure HTML; otherwise, you're constantly fighting > with Amber. > > Thus, when it comes time to process your form, you can resort to > Amber, but that means duplicating some of the form definition in > Amber, in particular, creating a dictio nary of all the input fields > you want to collect upon submission. You do not need to generate 'definition in data-pseudolanguage' that you then interpret in code (that is complex). In Web, you most often just add method like `renderFormOn: html` and call it in renderOn:, in Silk you just create method like `myForm` that returns array of elements, and you then just `<< self myForm` somewhere where you define DOM content (either once in ad-hoc once-called method; or in renderOnSilk: of some class). IOW, Smalltalk way is (afaict) to put snippets of code that generate the structure, and call them at proper point; not to have interpret data structures. > More duplication is involved if you also want to do your own input > validation (eg, required, pattern-matching, minimum/maximum value, etc.). If you define event only in Amber, not in HTML, there is no duplication. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
I tried to install Silk. I followed your instructions (create Amber project; run 'bower install silk --save' and 'grunt devel'), but I cannot find any indication that Silk exists in my project. I can't find 'Silk' in the class browser. I can't find any hint of Silk in the files and folders of my project.
-- Btw, I'm encountering an odd situation when I create a new project...
I really should clean this up by starting from scratch. But I don't know how to 'uninstall' Amber and start from a pristine state. On Tuesday, 2 June 2015 15:44:05 UTC-4, Herby wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Dňa 3. júna 2015 0:28:31 CEST používateľ Richard Eng <[hidden email]> napísal: > I tried to install Silk. I followed your instructions (create Amber > project; run 'bower install silk --save' and 'grunt devel'), but I Why would it load if no one expressrs the need for it? As with every library, getting it physically into project is first step, getting it logically to project itself is the next step (that is, adding 'silk/Silk') into `imports:` of a package that plan to use it. > cannot > find any indication that Silk exists in my project. I can't find > 'Silk' in > the class browser. I can't find any hint of Silk in the files and > folders > of my project. If you ran 'bower install silk --save' in the root foldet of the project and it succeeded, they are there, no fear. > > Btw, I'm encountering an odd situation when I create a new project... > > Unable to find a suitable version for amber, please choose one: > > > > 1) amber#0.14.13 which resolved to 0.14.13 and is required by > helios#0.4.4 > > 2) amber#* which resolved to 0.14.14 and is required by > amber-contrib-jquery#0.1.0, amber-contrib-web#0.1.1 > > 3) amber#>=0.14.14 which resolved to 0.14.14 and is required by > amber-contrib-legacy#0.2.1 > > 4) amber#^0.14.13 which resolved to 0.14.14 and is required by eric > > > > > Prefix the choice with ! to persist it to bower.json > > > I really should clean this up by starting from scratch. But I don't > know > how to 'uninstall' Amber and start from a pristine state. npm install -g amber-cli This line is in every migration guide as the first thing, to update the amber cli command and its deps (new project template used in 'amber init' being among them). > > > On Tuesday, 2 June 2015 15:44:05 UTC-4, Herby wrote: > > > > > > > > Richard Eng wrote: > > > I've learned a very important lesson from this Amber exercise. For > all > > > but the simplest HTML layouts, it is impractical to use Amber to > > > generate forms. HTML5 is very complex and offers unbelievable > > > flexibility in UI design (eg, size and maximum length of input, > > > placeholder text, preselection for checkbox or radio, autofocus, > > > autocomplete, etc.). If you have a complex interface, it's best to > > > > > All those things are attributes. It is not hard to add them in Amber > Web > > (at:put:), and it is even easier to add them in Silk (just put an > inline > > #{'key'->'value'...} object into HTML stream. Have you tried Silk > for > > different approach to generate DOM content (saying 'HTML' is not > accurate). > > > > > code your form in pure HTML; otherwise, you're constantly fighting > > > > with Amber. > > > > > > Thus, when it comes time to process your form, you can resort to > > > Amber, but that means duplicating some of the form definition in > > > Amber, in particular, creating a dictio > > nary of all the input fields > > > you want to collect upon submission. > > > > You do not need to generate 'definition in data-pseudolanguage' that > you > > then interpret in code (that is complex). In Web, you most often > just add > > method like `renderFormOn: html` and call it in renderOn:, in Silk > you just > > create method like `myForm` that returns array of elements, and you > then > > just `<< self myForm` somewhere where you define DOM content (either > once > > in ad-hoc once-called method; or in renderOnSilk: of some class). > > > > IOW, Smalltalk way is (afaict) to put snippets of code that generate > the > > structure, and call them at proper point; not to have interpret data > > > structures. > > > > > More duplication is involved if you also want to do your own input > > > > validation (eg, required, pattern-matching, minimum/maximum value, > > > etc.). > > > > If you define event only in Amber, not in HTML, there is no > duplication. > > > > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Herby Vojčík
I found a way! I am so happy, happy, happy...
--
This allows for HTML5 validation. When you click the 'submit' button, #collectValues is executed; if the form is not valid, then it returns true and you must enter valid form input. When #collectValues is called again and the form is valid, you can return false thereby circumventing propagation. All of the HTML form behaviours are preserved. On Tuesday, 2 June 2015 04:23:46 UTC-4, Herby wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |