knop adjustments for HTML 5

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

knop adjustments for HTML 5

mail

Has there been any progress, is anyone working on it even, to add various HTML types to Knop? I am trying to at least get "range" added as a type.  Can anyone help with this? Where else I might need to add code to handle a new type? The modifications I attempted fail when my new "range" type is used

Error Message: 
at: addfield with params: -name='item_val1', -id='item_val1', -type='range', -min='0', -max='10', -value='5', -label='Sufficient

I have modified the version of knop.lasso from Knop demo package 2008-09-24.zip.

line 2381
    define_tag: 'addfield', -description='Inserts a form element in the form.
...
       -optional='min',
        -optional='max',
...

line 2504
        local_defined('min') ? #field -> insert('min' = #min);
        local_defined('max') ? #field -> insert('max' = #max);

line 3460 (this was a copy of what was there for case "text")
  case: 'range';
    #renderfield += '<input type="range"'
      + #renderfield_base
      + ' value="' + (encode_html: #fieldvalue) + '"'
      + (#onefield >> 'size'   ? ' size="' + (#onefield -> (find: 'size')) + '"' )
      + (#onefield >> 'min'   ? ' min="' + (#onefield -> (find: 'min')) + '"' )
      + (#onefield >> 'max'   ? ' max="' + (#onefield -> (find: 'max')) + '"' );
    if: !(self -> 'noscript') && (#onefield -> (find: 'hint')) != '';
      #renderfield += ' onfocus="clearHint(this)" onblur="setHint(this, \'' (#onefield -> (find: 'hint')) '\')"';
      #usehint -> (insert: (#onefield -> find: 'name') = #id);
    /if;
    if: !(self -> 'noscript') && !#nowarning;
      #renderfield += ' onkeydown="dirtyvalue(this)" onkeyup="makedirty(this)"';
    /if;
    #renderfield += #endslash + '>';


-- 

#############################################################

This message is sent to you because you are subscribed to

the mailing list <[hidden email]>.

To unsubscribe, E-mail to: <[hidden email]>

Send administrative queries to  <[hidden email]>

List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html

Project homepage http://montania.se/projects/knop/

Google Code has the latest downloads at http://code.google.com/p/knop/


	
	
	
	
Reply | Threaded
Open this post in threaded view
|

Re: knop adjustments for HTML 5

Johan Solve-2
You really should start with the latest knop.lasso from the SVN respository. You can access it with a browser here
http://code.google.com/p/knop/source/browse/#svn%2Ftrunk%2Fto%20LassoLibraries


Here are a few pointers to get you started:
- Add the new type to #validfieldtypes
- As a new case in the select: #fieldtype tree for both renderform and renderhtml
- You need to add -min, -max and -step as new parameters, and corresponding checks for them (look at how select, radio and checkbox validate the -options parameter).
As a lazy solution to this you can rely on the -raw parameter to add those parameters hard coded as Knop don't need to know about them (unless they will be used for server side validation).

You seem to have covered most of this already (I wish I read your entire message before I started writing a reply), except maybe adding range to "validfieldtypes.

While developing Knop you'll find it easier to include the source file for the ctype directly in your test page. That way you don't have to reload the namespace all the time. The included type will override the one  loaded as namespace librray in knop.lasso
You find the source files here http://code.google.com/p/knop/source/browse/#svn%2Ftrunk%2F_ctype


At 22.40 -0700 2011-04-05, <[hidden email]> wrote:

>Has there been any progress, is anyone working on it even, to add various HTML types to Knop? I am trying to at least get "range" added as a type.  Can anyone help with this? Where else I might need to add code to handle a new type? The modifications I attempted fail when my new "range" type is used
>
>Error Message:
>at: addfield with params: -name='item_val1', -id='item_val1', -type='range', -min='0', -max='10', -value='5', -label='Sufficient
>
>I have modified the version of <http://knop.lasso>knop.lasso from Knop demo package 2008-09-24.zip.
>
>line 2381
>    define_tag: 'addfield', -description='Inserts a form element in the form.
>...
>       -optional='min',
>        -optional='max',
>...
>
>line 2504
>        local_defined('min') ? #field -> insert('min' = #min);
>        local_defined('max') ? #field -> insert('max' = #max);
>
>line 3460 (this was a copy of what was there for case "text")
>
>  case: 'range';
>    #renderfield += '<input type="range"'
>      + #renderfield_base
>      + ' value="' + (encode_html: #fieldvalue) + '"'
>      + (#onefield >> 'size'   ? ' size="' + (#onefield -> (find: 'size')) + '"' )
>      + (#onefield >> 'min'   ? ' min="' + (#onefield -> (find: 'min')) + '"' )
>      + (#onefield >> 'max'   ? ' max="' + (#onefield -> (find: 'max')) + '"' );
>    if: !(self -> 'noscript') && (#onefield -> (find: 'hint')) != '';
>      #renderfield += ' onfocus="clearHint(this)" onblur="setHint(this, \'' (#onefield -> (find: 'hint')) '\')"';
>      #usehint -> (insert: (#onefield -> find: 'name') = #id);
>    /if;
>    if: !(self -> 'noscript') && !#nowarning;
>      #renderfield += ' onkeydown="dirtyvalue(this)" onkeyup="makedirty(this)"';
>    /if;
>    #renderfield += #endslash + '>';
>
>
>--
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>
>the mailing list <[hidden email]>.
>
>To unsubscribe, E-mail to: <[hidden email]>
>
>Send administrative queries to  <[hidden email]>
>
>List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
>
>Project homepage http://montania.se/projects/knop/
>
>Google Code has the latest downloads at http://code.google.com/p/knop/


--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[hidden email]
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: knop adjustments for HTML 5

stevepiercy
In reply to this post by mail
On 4/5/11 at 10:40 PM, [hidden email] pronounced:

>Has there been any progress, is anyone working on it even, to
>add various HTML types to Knop?

I am not aware of any effort to add the new HTML5 form elements
or attributes.  Here are some nice reference materials for those
who want to contribute:
https://developer.mozilla.org/en/HTML/HTML5/Forms_in_HTML5
http://diveintohtml5.org/forms.html

>I am trying to at least get "range" added as a type. Can anyone help with this?

Sure.

>Where else I might need to add code to handle a new type? The
>modifications I attempted fail when my new "range" type is used
>
>Error Message:  at: addfield with params: -name='item_val1',
>-id='item_val1', -type='range', -min='0', -max='10',
>-value='5', -label='Sufficient
>
>I have modified the version of knop.lasso <http://knop.lasso>
>from Knop demo package 2008-09-24.zip.

I would not work on that version.  No one I know is actively
developing from an old version of Knop, while everyone who is
developing starts from the latest version in the Subversion
repository.  Strongly suggest you do the same to avoid
versioning issues.
http://knop.googlecode.com/svn/trunk/

I avoid editing knop.lasso.  I work in the specific type that I
want to modify.  knop.lasso is generated automatically by the
build script, buildnamespace.lasso, from the individual items in
the _ctag and _ctype folders.  Since I use Subversion, I can
edit these files at will, and load them into a page at runtime
instead of throwing them into Libraries or Startup.  I never
have to worry about screwing up, because I can always revert.  
But if my work is good enough to commit, then I can synch it up
with the repo.

I have a special folder /dev/ that contains files for testing a
Knop solution, but points to the types and tags of my Knop
working copy.  I've also modified my urlhandler to set the
proper $siteroot based on response_filepath.

When doing work and sharing contributions, I work on the
following sections, from top to bottom:
* CHANGE NOTES for documentation.
* Add a local variables for instantiation.
* Add parameters to the oncreate method (define_tag:
'oncreate'), and include a sufficient description for the
parameters so that the help.lasso file will render the documentation.
* All the rest of the code to make the modification function.

 From what follows, it appears you omitted the first three of
four steps above, so you'll need to do that, too.

>line 2381
>   define_tag: 'addfield', -description='Inserts a form element in the form.
>...
>     -optional='min',
>      -optional='max',
>...

add for completeness:
     -optional='step',

>line 2504
>      local_defined('min') ? #field -> insert('min' = #min);
>      local_defined('max') ? #field -> insert('max' = #max);

add for completeness:
        local_defined('step') ? #field -> insert('step' = #step);

>line 3460 (this was a copy of what was there for case "text")
>
> case: 'range';
>   #renderfield += '<input type="range"'      + #renderfield_base
>     + ' value="' + (encode_html: #fieldvalue) + '"'
>     + (#onefield >>'size'   ? ' size="' + (#onefield -> (find: 'size')) + '"' )
>     + (#onefield >>'min'   ? ' min="' + (#onefield -> (find: 'min')) + '"' )
>     + (#onefield >>'max'   ? ' max="' + (#onefield -> (find: 'max')) + '"' );

add for completeness:
       + (#onefield >>'step'   ? ' step="' + (#onefield
-> (find: 'step')) + '"' );

>   if: !(self -> 'noscript') &&(#onefield -> (find: 'hint')) != '';
>     #renderfield += ' onfocus="clearHint(this)"
>onblur="setHint(this, \'' (#onefield -> (find: 'hint')) '\')"';
>     #usehint -> (insert: (#onefield -> find: 'name') = #id);
>   /if;
>   if: !(self -> 'noscript') &&!#nowarning;
>     #renderfield += ' onkeydown="dirtyvalue(this)" onkeyup="makedirty(this)"';
>   /if;
>   #renderfield += #endslash + '>';

So that is about it for the addfield method for the form type.

Next you need to work on the renderform and renderhtml methods
for the form type.  These are the methods that make the input
appear and add javascripts.

Let me know if you need further direction.

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: knop adjustments for HTML 5

Johan Solve-2
At 01.02 -0700 2011-04-06, Steve Piercy - Web Site Builder wrote:

>>line 3460 (this was a copy of what was there for case "text")
>>
>> case: 'range';
>>   #renderfield += '<input type="range"'      + #renderfield_base
>>     + ' value="' + (encode_html: #fieldvalue) + '"'
>>     + (#onefield >>'size'   ? ' size="' + (#onefield -> (find: 'size')) + '"' )
>>     + (#onefield >>'min'   ? ' min="' + (#onefield -> (find: 'min')) + '"' )
>>     + (#onefield >>'max'   ? ' max="' + (#onefield -> (find: 'max')) + '"' );
>
>add for completeness:
>      + (#onefield >>'step'   ? ' step="' + (#onefield -> (find: 'step')) + '"' );
>
>>   if: !(self -> 'noscript') &&(#onefield -> (find: 'hint')) != '';
>>     #renderfield += ' onfocus="clearHint(this)" onblur="setHint(this, \'' (#onefield -> (find: 'hint')) '\')"';
>>     #usehint -> (insert: (#onefield -> find: 'name') = #id);
>>   /if;
>>   if: !(self -> 'noscript') &&!#nowarning;
>>     #renderfield += ' onkeydown="dirtyvalue(this)" onkeyup="makedirty(this)"';
>>   /if;
>>   #renderfield += #endslash + '>';
>
>So that is about it for the addfield method for the form type.
>
>Next you need to work on the renderform and renderhtml methods for the form type.  These are the methods that make the input appear and add javascripts.

The code above IS from renderform.
--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[hidden email]
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/