Arc Forumnew | comments | leaders | submitlogin
6 points by lojic 6138 days ago | link | parent

A small example is fine, but wouldn't it be better if it at least did some basic validation? How does the Arc example change if you enforce only alphanumeric characters in the input field?

  class HomeController < ApplicationController
    def first
      if request.get?
        aform 'first', [input('foo'), submit]
      else
        if params[:foo] && params[:foo] =~ /[A-Za-z0-9]/ 
          session[:foo] = params[:foo]
          wlink 'third', 'click here'
        else
          aform 'first', ["Please enter an alphanumeric string", input('foo'), submit]
        end
      end
    end

    def third
      pr "you said: #{session[:foo]}"
    end
  end
Of course, we'll then want to allow the designers to modify the presentation, and allow the copy writers to add compelling text, etc. So, it seems like a template system is the way to go, but maybe someone has a better idea.