#{extends '../../main.html'/}# #{set title:'Html Reference'/}# #{set tab:'management'/}# #{renderTagArgs '../docHome.html'/}#

Html Form Input

#{form action:@[POST_INPUT_TEXT_FORM]@, class:'form-horizontal'}# #{field 'firstName', label:'First Name'}# #{/field}# #{/form}#

The webpieces html code above is:

*[#{form action:@[POST_INPUT_TEXT_FORM]@, class:'form-horizontal'}#

  #{field 'firstName', label:'First Name'}#
    
  #{/field}#

  

#{/form}#]*

The webpieces routes for the above is:

*[scopedBldr.addRoute(BOTH, HttpMethod.GET , "/examples/input", "ExamplesController.inputText", ExampleRouteId.INPUT_TEXT);
scopedBldr.addRoute(BOTH, HttpMethod.POST, "/examples/postInput", "ExamplesController.postInputText", ExampleRouteId.POST_INPUT_TEXT_FORM);
scopedBldr.addRoute(BOTH, HttpMethod.POST, "/examples/inputResult", "ExamplesController.inputTextResult", ExampleRouteId.INPUT_TEXT_RESULT);]*

The Controller GET and POST methods for this page is:

*[    public Render inputText() {
		return Actions.renderThis(
				"menu", menuCreator.getMenu(),
				"firstName", null);
	}
	
	public Redirect postInputText(String firstName) {
		//We could put the firstName in the url such as /examples/inputResult/{firstName} 
		//or we could save to database
		//or we can put it in flash and for this example, we put it in flash
		Current.flash().put("firstName", firstName);
		Current.flash().keep();
		return Actions.redirect(ExampleRouteId.INPUT_TEXT_RESULT);
	}]*