[Seaside] Html5 inputs examples for seaside

Paul DeBruicker pdebruic at gmail.com
Thu Oct 31 00:56:01 UTC 2019


If you browse implementors of #textInput you'll see that its defined in
WAHtmlCanvas.  In that class in the tags-input protocol there are also
#dateInput5, #numberInput, #monthInput, #colorInput.

The default install of Seaside comes with examples of all of the inputs.  I
think if you go to http://127.0.0.1:8080/browse you can see them. 

What code are you trying that gives you errors?  Can you post it here?   If
you can it will make figuring out whats wrong much easier. 



An example of a component that takes two numbers and calculates a result
then displays  it is:  


WAComponent subclass: #MyComponent
        instanceVariableNames: 'firstNumber secondNumber result'
	classVariableNames: ''
	package: 'MyPackage'

MyComponent>>#initialize
   super initialize.
   firstNumber:=0.
   secondNumber :=0.
   result:='Nothing yet'.

MyComponent>>#firstNumber
    ^ firstNumber

MyComponent>>#secondNumber
    ^ secondNumber

MyComponent>>#firstNumber: aNumberString
     firstNumber := aNumberString asNumber

MyComponent>>#secondNumber: aNumberString
    secondNumber := aNumberString asNumber

MyComponent >> #calculateResult
   result := firstNumber raisedTo: secondNumber.

MyComponent>>#renderContentOn: html

html form 
   id:'myForm'; 
   with:[

  html numberInput
     step: 0.1;
     min: -1; 
     max: 1;
     on: #firstNumber of: self.

  html numberInput
     step: 10;
     min: -100; 
     max: 100;
     on: #secondNumber of: self.

  html hiddenInput
     callback: [self calculateResult].

  html submitButton
    with:'Calculate Result'].


html heading level1; with:'Result:'.
html heading level3; with: result.




You can change the #calculateResult method to do anything including
persisting the value of result in another object or data store.  You can
change the number inputs to ignore the stored value of #firstNumber or
#secondNumber and always use a default value like this:

html numberInput
     step: 0.1;
     min: -1; 
     max: 1;
     value: -0.7;
     callback:[:val | self firstNumber: val ].

  html numberInput
     step: 10;
     min: -100; 
     max: 100;
    value: 20;
    callback:[:val |self  secondNumber: val].







OswallVernyAC wrote
> I would like to know if you have examples of use for html5 inputs in
> Seaside 3.3.
> I am with the Seaside book on the website. I have examples of textInput
> and
> others, however I am interested in inputs of numbers, dates, months, html5
> colors, apply calculations and get results.
> I have errors in syntax.
> I need to establish memory variables that should not persist and then
> perform calculations on methods and only totals persist.
> 
> Thanks in advance.
> Oswall
> 
> _______________________________________________
> seaside mailing list

> seaside at .squeakfoundation

> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside





--
Sent from: http://forum.world.st/Seaside-General-f86180.html


More information about the seaside mailing list