package flexa.ff;

import flexa.fb.*;
import java.util.Map;
import java.util.HashMap;



public class input extends FField {
    
    
    
    public input() {
        super("ff.input");
    }

	// Update value from HTTP Request (HTML Field: INPUT/COMBO/etc)
	public void updateFromRequest(HashMap<String, Object> aParameters) throws Exception {
		String tName = (String)this.getValue("id");
		String tType = (String)this.getValue("type");
	    if( aParameters.containsKey(tName) ) {
	        String tVal = (String)aParameters.get(this.getValue("id"));
            Log.getInstance().info("updateFromRequest " + tName + " type " + tType + " = " + tVal);
			switch(tType) {
			    case "integer":
			        this.setValue("value", (tVal == null || tVal.trim().equals("")) ? 0 : Integer.parseInt(tVal));
			        break;
			    case "decimal":
			    case "money":
			    case "date":
			    case "datetime":
			    case "timestamp":
			    case "time":


			    case "text":
			    case "password":
			    case "email":
			    case "url":
			    case "tel":
			    case "checkbox":
                default:
                    this.setValue("value", tVal);
			}
		}
	}    


}