SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 62
  1. #26
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have you seen HTML_Template_Flexy from PEAR?
    Yep. It's also getting "there" in the sense of being able to declare runtime components (read: controls) in a template. It carries alot of old style PHP template markup which may or may not be a good thing - those curly brackets will probably show up nicely in dreamweaver but it also supports mapping HTML tags to components and I think this is already being used to tie in with HTML_Quickform. So far I don't think Alan's made it possible to map to your own "ad-hoc" classes e.g. a "Repeater" component. Providing that usefully will be tricky - PEAR doesn't have a standard set of iterators for example.

  2. #27
    Non-Member
    Join Date
    Jan 2004
    Location
    Planet Earth
    Posts
    1,764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    What is the best way of mapping control components to any given tags ?

    I don't mean in regard to the template generators mentioned in this thread, but in general


    Thanks

  3. #28
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mwmitchell
    So, in order to use this template engine, the client must have js enabled?

    Matt
    I'd just like to clear this one up:
    No, there is no need for the client to have javascript enabled to use ASP.NET apps. My latest site is all ASP.NET and uses all kinds of features of it extensively, and it works just fine with javascript disabled.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  4. #29
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by M. Johansson
    I'd just like to clear this one up:
    No, there is no need for the client to have javascript enabled to use ASP.NET apps. My latest site is all ASP.NET and uses all kinds of features of it extensively, and it works just fine with javascript disabled.
    OK, the part I guess I'm confused about (and I should probably go read an asp tutorial maybe?), is that in the examples in this template engine package, there are <a>link</a> tags, with special 'onClick' like attributes. I turned off JS, and none of the examples worked.

    Matt

  5. #30
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, that's likely this template engine, and not ASP.NET. ASP.NET detects if your brwoser is JS-enabled and serves you pages accordingly.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  6. #31
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript

    Quote Originally Posted by mwmitchell
    OK, the part I guess I'm confused about (and I should probably go read an asp tutorial maybe?), is that in the examples in this template engine package, there are <a>link</a> tags, with special 'onClick' like attributes. I turned off JS, and none of the examples worked.

    Matt
    If you want to use HTML anchor as a button (ASP.NET calls it asp:LinkButton, but I chose <a type=postback runat=server>), then javascript is required to post back the form, because the output will print it as <a href='javascript:__doPostBack()'>.

    Workaround could be that there is a setting (may be server check if JS is enabled?) to print it as <input type='submit' >... or <input type='image'>, but then you still have to take care of appearance because the look of an input box and HTML anchor is quite different.

  7. #32
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by M. Johansson
    I'd just like to clear this one up:
    No, there is no need for the client to have javascript enabled to use ASP.NET apps. My latest site is all ASP.NET and uses all kinds of features of it extensively, and it works just fine with javascript disabled.
    I think if you have LinkButton you still need javascript. To test, go to asp.net tutorials -> server controls reference -> linkbutton and turn off js. In my example I use <a runat=server> extensively because I 'm lazy to make image button.

  8. #33
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hongnk
    I think if you have LinkButton you still need javascript. To test, go to asp.net tutorials -> server controls reference -> linkbutton and turn off js. In my example I use <a runat=server> extensively because I 'm lazy to make image button.
    OK, I totally understand now! Thanks

    Matt

    EDIT:

    So can you show how you would post-back without JS? Would you just create a form, and add an image button with the required attributes?

    Matt
    Last edited by mwmitchell; Apr 4, 2004 at 18:20.

  9. #34
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mwmitchell
    OK, I totally understand now! Thanks

    Matt

    EDIT:

    So can you show how you would post-back without JS? Would you just create a form, and add an image button with the required attributes?

    Matt
    The below example just do some silly things: when click on the image, change its picture to something else, and change the span content to the value of the text box. No JS required.

    HTML page: test.kpf.php
    Code:
    <page inherits="test" codebehind="test.php">
    <form runat="server">
    <input runat="server" id="mytext" type="text" value="test">
    <input type="image" id="myimage" src="image.gif" runat="server" >
    </form>
    <span runat="server" id="message"></span>
    PHP page: test.php
    Code:
    <?
    class test extends kPage {
        function myimage_click(){
            //change src attribute
            $this->postimage->src="somethingelse.gif";
            //print out mytext value
            $this->message->text='<font color=red>'.$this->mytext->value.'</font>';
        }
    }
    ?>

  10. #35
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hongnk
    Thanks Manuel, I will do it. Did you try my class already, any feedback?
    Sorry, no. I will probably not have the time.

    Anyway, from what I have seen so far, I am not very impressed with ASP.NET. I may be wrong, but from what I could see in the examples, it still does not foster the separation of the application logic from the presentation.

    It seems that ASP.NET has gone backwards to the past and went the ColdFusion way by creating new tags that define application operations so the developers can mess them in the output templates and make a big spaghetti thing.

    For instance when it comes to forms, the definition of application logic should be done in code, not in pseudo-HTML files.

    Currently I used this very popular and mature forms generation class. It lets me define form inputs including validation logic and other sophisticated form handing features with separate functions. Then I can use a simple HTML template file with a few PHP code sections to define where inputs and labels will appear within the HTML.

    Here is an example of a small form:

    PHP Code:
    <?php
     
      $form
    =new form_class;

      
    $form->AddInput(array(
        
    "NAME"=>"user_name",
        
    "TYPE"=>"text",
        
    "ValidateAsNotEmpty"=>1,
        
    "ValidationErrorMessage"=>"You have not specified the user name"
      
    ));

      
    $form->AddInput(array(
        
    "NAME"=>"password",
        
    "TYPE"=>"text",
        
    "ValidateAsNotEmpty"=>1,
        
    "ValidationErrorMessage"=>"You have not specified the password"
      
    ));

      
    $form->AddInput(array(
        
    "ID"=>"submit",
        
    "TYPE"=>"submit"
      
    ));

      
    $form->StartLayoutCapture();
      include(
    "my_form_template.html.php");
      
    $form->EndLayoutCapture();

      
    $form->DisplayOutput();
    ?>
    Here is an example of the output template that is included:

    PHP Code:
    <table>

    <tr>
    <th><?php
      $form
    ->AddLabelPart(array(
        
    "FOR"=>"user_name",
        
    "LABEL"=>"<u>U</u>ser name",
        
    "ACCESSKEY"=>"U"
      
    ));
    ?>:</th>
    <td><?php $form->AddInputPart("user_name"); ?></td>
    </tr>

    <tr>
    <th><?php
      $form
    ->AddLabelPart(array(
        
    "FOR"=>"password",
        
    "LABEL"=>"<u>P</u>assword",
        
    "ACCESSKEY"=>"P"
      
    ));
    ?>:</th>
    <td><?php $form->AddInputPart("password"); ?></td>
    </tr>

    <tr>
    <td colspan="2"><?php $form->AddInputPart("submit"); ?></td>
    </tr>

    </table>
    The class also comes with a pluging to support the use of Smarty templates for those that prefer it:

    PHP Code:
    <table>

    <
    tr>
    <
    th>{label for="user_name"}:</th>
    <
    td>{input name="user_name"}</td>
    </
    tr>

    <
    tr>
    <
    th>{label for="password"}:</th>
    <
    td>{input name="password"}</td>
    </
    tr>

    <
    tr>
    <
    td colspan="2">{input name="submit"}</td>
    </
    tr>

    </
    table
    As you may see there is no application logic in the presentation templates nor any HTML in the form definition and handling logic.

    Given that this is a PHP based solution that exists and matured for many years (since 1999) to address the needs of PHP developers, what do you think that provides some kind of advantage a ASP.NET like solution?
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP

  11. #36
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mlemos
    Anyway, from what I have seen so far, I am not very impressed with ASP.NET. I may be wrong, but from what I could see in the examples, it still does not foster the separation of the application logic from the presentation.
    I'm poor on methodology. I guess Harry/Johansson could give their opinion.

    Quote Originally Posted by mlemos
    For instance when it comes to forms, the definition of application logic should be done in code, not in pseudo-HTML files.
    Actually, ASP.NET (and KPF) allows you to define control properties, validation rules in code as well, if you don't want to write as tag attributes.

    Given that this is a PHP based solution that exists and matured for many years (since 1999) to address the needs of PHP developers, what do you think that provides some kind of advantage a ASP.NET like solution?
    From the first glance for that solution, a lazy guy like me will prefer ASP.NET way, because no need to write much code:

    Code:
    <table>
    
    <tr>
    <th><label for="user_name">:</th>
    <td><input id="user_name" runat="server">
    <span type="validator" for="user_name" pattern=".+">
    You have not specified the user name</span>
    </td>
    </tr>
    
    <tr>
    <th><label for="password">:</th>
    <td><input id="password" runat="server">
    <span type="validator" for="password" pattern=".+">
    You have not specified the password</span>
    </td>
    </tr>
    
    <tr>
    <td colspan="2"><input type="submit" runat="server" id="submit"></td>
    </tr>
    
    </table>
    Note about the "validator" spans above: I use regexp to test the input (pattern='.+'). The spans will be hidden at first load.

    Now is the code:
    PHP Code:
    function submit_click(){
    //validate based on the pattern defined in validator spans, return $this->is_valid;
    $this->validate();
    if(
    $this->is_valid){
    //process
    }

    If $this->is_valid==false then the page will show back (with input values s\mainatined), and now the span messages will appear.

    Well, I know that application logic is now messed with presentation (validators), but I don't really bother. However, I can also remove the spans, create a Validator class, include it in PHP code, then call it to parse the data instead of the default validate method...

  12. #37
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WACT benchmark

    Hi Harry

    I created WACT benchmark (attached) to test KPF performance. My PC (PIII 500 Win XP 256RAM, Apache 1.3 + PHP 4.3.4) shows 8 requests/sec (cp. WACT is 29 req/sec, native is 50 req/sec).

    The heavy work is not at ADODB (I tried to change to mysql native and gained less than 1 req/sec). It is the way KPF keep all server controls are objects in memory and run recursive loop to print them out.

    I like the way WACT compiler works, so I did modify databind method to save a compiled version of the loop, then just include it to print output. The result now is 24 req/sec.

    But this defeat the dynamic nature of KPF, which allows things like nested repeater, user controls inside repeater, user event (intercept the binding process, post back, viewstate)... It only works with simple list.

    Outght to work out a way to cache the repeater output. I will review on ASP.NET caching (didn't pay attention on it yet). Any suggestion is greatly appreciated.
    Attached Files Attached Files

  13. #38
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I feel the template handling with code-behind files is really a big step forward when programming webpages
    if you want code-behind and the page object (and its implicit overhead (with an interpreted language)) go .NET , if you want JAVA and more abstraction go JAVA, if you want what PHP is supposed to be ...

    sorry , not picking on the above poster , but I am forced to agree with Manuel (however dangerous that can be in certain circles )

    I appreciate the brains behind the projects noted , its the common-sense of it all that escapes me , I was nearly sucked in for a while... but at the end of the day psuedo-OO/procedural hybrids seem (despite the obvious contrary logic here) simpler to maintain and quicker to build than massive libraries/frameworks of mostly bloated and often inefficient (by thier very nature) code.

    You end up with .NET or JAVA framework by any other name & thats not IMO the point.

  14. #39
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A bit off-topic here.
    Quote Originally Posted by mlemos
    It seems that ASP.NET has gone backwards to the past and went the ColdFusion way by creating new tags that define application operations so the developers can mess them in the output templates and make a big spaghetti thing.

    For instance when it comes to forms, the definition of application logic should be done in code, not in pseudo-HTML files.

    ...

    As you may see there is no application logic in the presentation templates nor any HTML in the form definition and handling logic.
    I just gave it a thought and feel that Manuel went too extreme. I think as time goes some application logic tasks become common and will gradually merge into presentation layer. In HTML we already have <input maxlength=""> as early form of validation. Then newer WML (WAP 1.0)has "<input noempty="true/false"> which take over the common validation task. After all, those codes (like form generator) are doing display, not real application logic.

    The intervention of application logic into presentation is unavoidable when we need the repeater loop, fill the list.... You can't say "OK, designer you design the HTML page, I will write a separate code and it will automatically iterate and print the list nicely".

    By the way, how the client side javascript map into this separation model?

  15. #40
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You end up with .NET or JAVA framework by any other name & thats not IMO the point.
    Can I just throw in that that's not what WACT is about. A (possible) nice to have would be a template parser capable of parsing ASP.NET's templates - that way you could use Microsoft's WYSIWYG editors to drag and drop PHP templates. That's as far as it goes with WACT. WACT will require some understanding of OOP to use so probably rule out beginners but for the rest of us, this, for example, probably makes life easier than native PHP. And there's be no JavaScript based event model either...

  16. #41
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by firepages
    if you want code-behind and the page object (and its implicit overhead (with an interpreted language)) go .NET , if you want JAVA and more abstraction go JAVA, if you want what PHP is supposed to be ...

    sorry , not picking on the above poster , but I am forced to agree with Manuel (however dangerous that can be in certain circles )

    I appreciate the brains behind the projects noted , its the common-sense of it all that escapes me , I was nearly sucked in for a while... but at the end of the day psuedo-OO/procedural hybrids seem (despite the obvious contrary logic here) simpler to maintain and quicker to build than massive libraries/frameworks of mostly bloated and often inefficient (by thier very nature) code.

    You end up with .NET or JAVA framework by any other name & thats not IMO the point.
    I believe PHP programmers inventing templates out of the need, not because of any theory. In my case it is speed of development. And it is serving myself well in my projects.

    Is pure PHP simpler to build? No, take this vBulletin software as example, it should be a trivial application when using my template. Is it simpler to maintain? I guess not. I run across some posts that the text run out of the screen and have to scroll left and right to read. But to correct it you have to walk through the code to spot the HTML tags that is hidden inside some block of PHP. Using my template it is straitforward: open the template file in Dreamweaver and adjust any attributes you need visually.

    Yes there is trade off for speed but not very much when application grows big. I am doing a CRM project that have the same interface with dotproject calendar (dotproject.sf.net). It is only a few percent slower (checked with xdebug 0.7s vs 0.9s ). And that page only needs a few line of codes (the calendar itself is already packed as user control), while in dotproject it is a page of php echos.

    I also don't think .NET vs PHP is important. The network speed to send the page to client is often the bottleneck rather than the difference time of interpreting vs native code. But this one I haven't tested yet :-)

  17. #42
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it possible to use this framework with $_GET variables instead of $_POST?

    If I wanted to build my site, I don't think I'd want to rely on JS to make simple <a> tags work for text, and I wouldn't want to create buttons for everything either. So, a simple <a href="the required variables here...">my link</a> tag with text would be ideal.

    Is this possible?

    Matt

  18. #43
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mwmitchell
    Is it possible to use this framework with $_GET variables instead of $_POST?

    If I wanted to build my site, I don't think I'd want to rely on JS to make simple <a> tags work for text, and I wouldn't want to create buttons for everything either. So, a simple <a href="the required variables here...">my link</a> tag with text would be ideal.

    Is this possible?

    Matt
    Yes, just do as you would do normally with PHP. However you have to write the code to parse $_GET inside page_load() (see details.kpf.php sample, I am using $_GET). If you don't want postback then do not use <form runat=server>.

  19. #44
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hongnk
    I just gave it a thought and feel that Manuel went too extreme. I think as time goes some application logic tasks become common and will gradually merge into presentation layer.
    You are thinking of project development as a single person task. In the real world it is more convenient to split tasks, presentation for graphic designers and programming for developers. If you mess presentation and programming details in the same files you end up with a big project conflict problems between designers and programmers, not to think that it will end up with hard to maintain projects that delay project releases.

    Quote Originally Posted by hongnk
    In HTML we already have <input maxlength=""> as early form of validation. Then newer WML (WAP 1.0)has "<input noempty="true/false"> which take over the common validation task. After all, those codes (like form generator) are doing display, not real application logic.
    You are missing the point. HTML and WML files are output that results from HTTP requests. Whatever generates those data files to the browse may either do it the messy way by not splitting the application logic details such as validation rules with presentation details of HTML or WML templates.

    The forms class that is described you promotes that separation. The class generates the HTML file that not only includes the HTML from templates designed by developers but also other fields and even Javascript to do early validation on the client side, besides the server side validation support provided by the class code itself.

    Quote Originally Posted by hongnk
    The intervention of application logic into presentation is unavoidable when we need the repeater loop, fill the list.... You can't say "OK, designer you design the HTML page, I will write a separate code and it will automatically iterate and print the list nicely".
    You are confusing the types of logic: application logic and presentation logic are different.

    The class that I described before can let the template designer define presentation loops by either inserting the necessary PHP code where and if needed in the HTML templates or using built-in controls when using Smarty templates. Still those are presentation details.

    Quote Originally Posted by hongnk
    By the way, how the client side javascript map into this separation model?
    Actually that is one of the strong points of the forms class. The developer just has to specify the validation rules of each input, the designer just has to specify the HTML and where the inputs and labels will appear, and the class will automagically make the necessary Javascript code be generated along inside the form HTML code.

    Not only it generates Javascript to validate input values but also to do sophisticated things, like preventing double form submission, activating or selecting specified input fields, do auto-completion or auto-formatting of fields according to format regular expressions, etc..

    Keep in mind that since this class has been developing since 1999, way before .NET existed, it had time to evolve and mature to address the most sophisticated developer needs.
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP

  20. #45
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mlemos
    Keep in mind that since this class has been developing since 1999, way before .NET existed, it had time to evolve and mature to address the most sophisticated developer needs.
    WAY off topic here, but how does your form package compare to Pear QuickForm?

    Matt

  21. #46
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mwmitchell
    WAY off topic here, but how does your form package compare to Pear QuickForm?
    Maybe I am not the person to make such comparision because I have never used quick form nor I am interested in entering any sort of competition. Maybe other people that tried both cangive their opinions.

    Anyway, here follows the list of features of the forms generation and validation class marking in bold the features that it seems it that that quick form does not have:
    • XHTML compliant output.
    • Load submitted form field values even with register_globals option Off and strip slashes when magic_quotes_gpc option is On.
    • Keyboard navigation support:
      • Attachment of labels with activation keys to each form field.
      • Tab navigation order index.
    • Built-in server side (PHP based) and client side (Javascript 1.0 or better) field validation for:
      • E-mail address
      • Credit card numbers (Visa, Mastercard, American Express, Discover, Diners Club, Carte Blanche, enRoute, JCB, any of these or even determined by a select field).
      • Regular expressions.
      • Field not empty.
      • Field equal to another (useful for password confirmation fields).
      • Field different from another (useful for reminder fields that must not be equal to the actual password).
      • As set (for check boxes, radio buttons and select multiple fields).
      • As integer number (with range limitation).
      • As floating point number (with range limitation).
      • Programmer defined client and server validation functions.
    • Option to define a value that, when used in a field, it is accepted without performing any of the validations defined for the field.
    • Ability to stop the user from submiting a form more than once inadvertently.
    • Sub form validation (validate only smaller set of field depending on the submit button that was used).
    • Composition and generation of the form HTML output with fields displayed as fully accessible or in read-only mode.
    • Generation of Javascript functions (useful to set to the page ONLOAD event):
      • Set the input focus to a field.
      • Select the text of a field.
      • Set the input focus and select the text of a field.
      • Enable and disable input fields
    • Automatic capitalization of the text of a field:
      • Upper case.
      • Lower case.
      • Word initials
    • Replacement of text field expressions to perform adjustments like trimming whitespace or auto-complete values based on rules defined by regular expressions
    • Compose forms with templates using plain HTML files with embedded PHP code or using the Smarty template engine with a supplied pre-filter plugin
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP

  22. #47
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by hongnk
    If you want to use HTML anchor as a button (ASP.NET calls it asp:LinkButton, but I chose <a type=postback runat=server>), then javascript is required to post back the form, because the output will print it as <a href='javascript:__doPostBack()'>.

    Workaround could be that there is a setting (may be server check if JS is enabled?) to print it as <input type='submit' >... or <input type='image'>, but then you still have to take care of appearance because the look of an input box and HTML anchor is quite different.
    Why not do the easiest thing and convert it to something like this?:
    Code:
    <input type="submit" name="linkbutton" 
    value="Save" style="border: none; background: transparent; color: blue; 
    text-decoration: underline; font-family: Arial;" />
    You get the same actions that a submit button performs but it will look like a link and work with JS disabled since there's no Javascript tied to it.
    Last edited by vgarcia; Apr 5, 2004 at 17:36.

  23. #48
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mlemos
    You are thinking of project development as a single person task.
    No I was thingking that presentation layer is the task of designer. My point is that asking him to learn one new validator tag is no harder than setting maxlength for input box. Validation is a basic task that has become part of presentation logic (again, this is just my thought).

    The engine will then auto-generate necessary javascript if the designer choose client-validation method (note my engine didn't implement it yet so only server-validation is available).

    Keep in mind that since this class has been developing since 1999, way before .NET existed, it had time to evolve and mature to address the most sophisticated developer needs.
    I do agree that form generator has most of neat thing that a form requires. Things like enable/disable fields, stop double submitting... are nice. In my engine you could write $this->inputbox->disabled=true, but this doesn't work on Netscape (not sure of Mozilla). So still have to write more codes to cater for this case.

    Edit:


    Oh BTW, in my shopping cart example, I stop double submit like this: (file checkout.kpf.php):
    if(mail(...)){ //if send mail successfully
    $this->submit->visible=false; //hide submit button
    $this->message->visible=true; //show message 'the form is submitted'
    }

    Oh sorry I'm wrong, that is not what double submit is about.


    But .NET form validation I believe has all what you describe.

  24. #49
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    Why not do the easiest thing and convert it to something like this?:
    Code:
    <input type="submit" name="linkbutton" 
    value="Save" style="border: none; background: transparent; 
    color: blue; text-decoration: underline; font-family: Arial;" />
    You get the same actions that a submit button performs but it will look like a link and work with JS disabled since there's no Javascript tied to it.
    Yes that's possible but you still lose things like a:hover, a:active... So I think just leave it to designer. If no-scripting support is mandatory then he's not allowed to use link button.

    PS. Could you edit your post, break the code line a bit so that the post is easier to read on my screen. Thx.

  25. #50
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hongnk
    No I was thingking that presentation layer is the task of designer. My point is that asking him to learn one new validator tag is no harder than setting maxlength for input box. Validation is a basic task that has become part of presentation logic (again, this is just my thought).
    I completely disagree. Validation rules are part of the Model and not of the View in a MVC approach. Presentation designers should never need to know and understand how to implement validation rules because it is not their competence, just like presentation design is not the competence of programmers, unless you are on a single person project or your project structure is so bad that you can't split competences.

    Actually, if you just think for instance of regular expression based validation rules, most people with only presentation design knowlegde will get knots on the brain just trying to understand the regular expression language syntax, even more trying to define non-trivial regular expressions all by themselves.


    Quote Originally Posted by hongnk
    I do agree that form generator has most of neat thing that a form requires. Things like enable/disable fields, stop double submitting... are nice. In my engine you could write $this->inputbox->disabled=true, but this doesn't work on Netscape (not sure of Mozilla). So still have to write more codes to cater for this case.

    But .NET form validation I believe has all what you describe.
    I don't know if .NET really can provide all that the forms class provides. What I asked and it seems you moved away from the question, is in terms of forms management, what does the ASP.NET provides that the PHP solutions don't and would consist in an advantage of using the ASP.NET approach?
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator
    PHP Classes - Free ready to use OOP components in PHP


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •