Other JS frameworks use a real HTML form to preserve semantics. You can call preventDefault() on the submit event to stop the browser from sending data to the server and navigating to a new page.
- Josh On Mon, Oct 17, 2016 at 8:59 AM, Alex Harui <aha...@adobe.com> wrote: > If I understand this thread, we actually need two kinds of Forms: > > 1) A low-level wrapper for HTMLFormElement. So what if it exits you out > of the app to another HTML page. Maybe that's all you need. > 2) A form-like thing for RIAs/single-page apps. We might need someone to > research how other JS frameworks handle single-screen apps and Forms. > Maybe they don't use Form under the covers and replicate a lot of the > functionality, or maybe there is some way to override the Form action and > keep your app running. > > Thanks, > -Alex > > On 10/17/16, 8:20 AM, "Peter Ent" <p...@adobe.com> wrote: > > >I'm in the middle of trying to a FlexJS mobile example to look nice on > >both iOS and Android, but I will add this to my todo list! I'm sure we can > >collaborate on it along with anyone else familiar with forms and how they > >think it should go in the flex world. Personally, I like to do as little > >as possible as a developer, so maybe Form is a bigger player and not > >suitable for the basic component set. > > > >—peter > > > >On 10/17/16, 10:51 AM, "carlos.rov...@gmail.com on behalf of Carlos > >Rovira" <carlos.rov...@gmail.com on behalf of > >carlos.rov...@codeoscopic.com> wrote: > > > >>Hi Peter, > >> > >>makes perfect sense. Maybe this is a more advance component and will be > >>better managed in your hands, since I'm still in the process of > >>understand > >>many things here. Moreover I'm making some progress in MDL branch, so If > >>you want to grab it feel free to do it. I think a Form component is one > >>of > >>the basic pieces, and many people would come to FlexJS and will try this > >>as > >>one of the first things. > >> > >>Thanks > >> > >> > >> > >>2016-10-17 16:42 GMT+02:00 Peter Ent <p...@adobe.com>: > >> > >>> > >>> When you do this in HTML, the action (eg, > >>> www.example.com?q=loc=miami&data=weather) sends all of the fields to > >>>the > >>> server which then sends back a new HTML page with the results. A lot of > >>> things happen automatically for you, such as pairing the values of the > >>> input fields with their IDs to form the query string or the POST. > >>> > >>> In Flex, maybe the Form has the ability to look at all its children for > >>> TextInput or IFormInput controls and gets their values and IDs and > >>> composes a FormActionEvent. A controller could listen for that, and > >>>cause > >>> an HTTPService to be invoked. When the controller gets the result back, > >>>it > >>> dispatches an event which something is listening for and then > >>>transitions > >>> from the Form to the next view (eg a Chart). > >>> > >>> Basically, I think the Form action should be more than just a URL in > >>>Flex; > >>> probably an event. Maybe in FlexJS all of the data extraction is the > >>>job > >>> of the app developer to do as they see fit and FlexJS really doesn't do > >>> much more than that. > >>> > >>> —peter > >>> > >>> On 10/17/16, 10:18 AM, "carlos.rov...@gmail.com on behalf of Carlos > >>> Rovira" <carlos.rov...@gmail.com on behalf of > >>> carlos.rov...@codeoscopic.com> wrote: > >>> > >>> >Hi Peter, > >>> > > >>> >makes sense. I was wrong with "action" property...is working ok right > >>>now > >>> >(maybe some wrong compilation), and right now if you hit ENTER, it > >>>goes to > >>> >www.example.com, so regarding what you say, you mean to add some > >>> >controller/model to the implementation? > >>> > > >>> > > >>> >2016-10-17 14:28 GMT+02:00 Peter Ent <p...@adobe.com>: > >>> > > >>> >> Shouldn't it be possible for the action on a <js:Form> to trigger an > >>> >>event > >>> >> that the application code (or its main controller) could use that > >>>would > >>> >> then decide to either open a new URL or go to a different FlexJS > >>>view? > >>> >> Usually, I would think, an HTML Form's action takes you to another > >>>part > >>> >>of > >>> >> the web "application" like the next set of forms to fill out or to > >>> >>submit > >>> >> your change of address. In the case of Flex, such an action usually > >>> >> triggers a HTTPService call that then displays more Flex UI based on > >>>the > >>> >> result of the HTTPService call. > >>> >> > >>> >> ‹peter > >>> >> > >>> >> On 10/17/16, 6:19 AM, "carlos.rov...@gmail.com on behalf of Carlos > >>> >>Rovira" > >>> >> <carlos.rov...@gmail.com on behalf of carlos.rov...@codeoscopic.com > > > >>> >> wrote: > >>> >> > >>> >> >I upload to develop a first working implementation of form, still > >>>no > >>> >> >functionality, but is nesting elements inside and showing correctly > >>>in > >>> >> >HTML > >>> >> >while surrounded by <form> tag. Only JS considerations (no SWF) > >>> >> > > >>> >> >My first question is how is managed properties in FlexJS. We don't > >>>have > >>> >> >commitProperties, so I supposed this was straight forward and > >>> >>implemented > >>> >> >an "action" property like this: > >>> >> > > >>> >> > private var _action:String = "#"; > >>> >> > > >>> >> > [Bindable("actionChange")] > >>> >> > /** > >>> >> > * The action to be performed when the form is submitted > >>> >> > * > >>> >> > * @langversion 3.0 > >>> >> > * @playerversion Flash 10.2 > >>> >> > * @playerversion AIR 2.6 > >>> >> > * @productversion FlexJS 0.0 > >>> >> > */ > >>> >> > public function get action():String > >>> >> > { > >>> >> > return _action; > >>> >> > } > >>> >> > > >>> >> > /** > >>> >> > * @private > >>> >> > */ > >>> >> > public function set action(value:String):void > >>> >> > { > >>> >> > _action = value; > >>> >> > > >>> >> > COMPILE::JS > >>> >> > { > >>> >> > this.element.setAttribute('action', action); > >>> >> > this.dispatchEvent('actionChange'); > >>> >> > } > >>> >> > } > >>> >> > > >>> >> >So using it as: > >>> >> > > >>> >> ><js:Form action="http://www.example.com"> > >>> >> >... > >>> >> > > >>> >> >Should translate to > >>> >> > > >>> >> ><form action="http://www.example.com"> > >>> >> >... > >>> >> > > >>> >> >but it remains action="#" > >>> >> > > >>> >> >so someone could point me on how implement getter/setters in > >>>FlexJS? > >>> >> > > >>> >> >Thanks > >>> >> > > >>> >> > > >>> >> >2016-10-17 8:42 GMT+02:00 Alex Harui <aha...@adobe.com>: > >>> >> > > >>> >> >> On 10/16/16, 11:31 PM, "carlos.rov...@gmail.com on behalf of > >>>Carlos > >>> >> >> Rovira" <carlos.rov...@gmail.com on behalf of > >>> >> >> carlos.rov...@codeoscopic.com> wrote: > >>> >> >> > >>> >> >> >Hi Alex, > >>> >> >> > > >>> >> >> >maybe I could implement it. It needs few things, action(normal > >>>the > >>> >>url > >>> >> >>to > >>> >> >> >call when submit the form). the method (GET, POST). > >>> >> >> >And we should allow to next input elements... I think to start > >>> >> >>something > >>> >> >> >basic should be ok. > >>> >> >> > >>> >> >> That would be great. And an example or test that shows what Form > >>> >>can do > >>> >> >> would help folks implement a SWF equivalent. > >>> >> >> > >>> >> >> > > >>> >> >> >To make it I would need some guidance about what component to > >>> >>extend, > >>> >> >>and > >>> >> >> >where lib to do it (Core? html?) > >>> >> >> > >>> >> >> Seems like it should go in the HTML.swc > >>> >> >> > >>> >> >> > >>> >> >> >And whatever consideration you know about the actual flexjs > >>> >>framework. > >>> >> >> > >>> >> >> I don't really know enough about Form to provide early guidance. > >>> >>Let's > >>> >> >> see what you come up with and go from there. > >>> >> >> > >>> >> >> -Alex > >>> >> >> > >>> >> >> > >>> >> > > >>> >> > > >>> >> >-- > >>> >> > > >>> >> >Carlos Rovira > >>> >> >Director General > >>> >> >M: +34 607 22 60 05 > >>> >> >http://www.codeoscopic.com > >>> >> >http://www.avant2.es > >>> >> > > >>> >> > > >>> >> >Este mensaje se dirige exclusivamente a su destinatario y puede > >>> >>contener > >>> >> >información privilegiada o confidencial. Si ha recibido este > >>>mensaje > >>> >>por > >>> >> >error, le rogamos que nos lo comunique inmediatamente por esta > >>>misma > >>> >>vía y > >>> >> >proceda a su destrucción. > >>> >> > > >>> >> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le > >>> >> >comunicamos > >>> >> >que sus datos forman parte de un fichero cuyo responsable es > >>> >>CODEOSCOPIC > >>> >> >S.A. La finalidad de dicho tratamiento es facilitar la prestación > >>>del > >>> >> >servicio o información solicitados, teniendo usted derecho de > >>>acceso, > >>> >> >rectificación, cancelación y oposición de sus datos dirigiéndose a > >>> >> >nuestras > >>> >> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la > >>>documentación > >>> >> >necesaria. > >>> >> > >>> >> > >>> > > >>> > > >>> >-- > >>> > > >>> >Carlos Rovira > >>> >Director General > >>> >M: +34 607 22 60 05 > >>> >http://www.codeoscopic.com > >>> >http://www.avant2.es > >>> > > >>> > > >>> >Este mensaje se dirige exclusivamente a su destinatario y puede > >>>contener > >>> >información privilegiada o confidencial. Si ha recibido este mensaje > >>>por > >>> >error, le rogamos que nos lo comunique inmediatamente por esta misma > >>>vía y > >>> >proceda a su destrucción. > >>> > > >>> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le > >>> >comunicamos > >>> >que sus datos forman parte de un fichero cuyo responsable es > >>>CODEOSCOPIC > >>> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del > >>> >servicio o información solicitados, teniendo usted derecho de acceso, > >>> >rectificación, cancelación y oposición de sus datos dirigiéndose a > >>> >nuestras > >>> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la > >>>documentación > >>> >necesaria. > >>> > >>> > >> > >> > >>-- > >> > >>Carlos Rovira > >>Director General > >>M: +34 607 22 60 05 > >>http://www.codeoscopic.com > >>http://www.avant2.es > >> > >> > >>Este mensaje se dirige exclusivamente a su destinatario y puede contener > >>información privilegiada o confidencial. Si ha recibido este mensaje por > >>error, le rogamos que nos lo comunique inmediatamente por esta misma vía > >>y > >>proceda a su destrucción. > >> > >>De la vigente Ley Orgánica de Protección de Datos (15/1999), le > >>comunicamos > >>que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC > >>S.A. La finalidad de dicho tratamiento es facilitar la prestación del > >>servicio o información solicitados, teniendo usted derecho de acceso, > >>rectificación, cancelación y oposición de sus datos dirigiéndose a > >>nuestras > >>oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación > >>necesaria. > > > >