【发布时间】:2014-07-13 08:12:17
【问题描述】:
我想创建一个动态问题网站,其中包含一些滚动、检查和任何框。 用户发送表单后,我想使用这些信息来动态创建答案。我尝试了很多,但无法使其正常工作。 所以我希望你能帮上忙。
get_event( 'Event_1', 1 ).
get_event( 'Event_2', 5).
get_component( 'Type_1', 'Component_1' ).
get_component( 'Type_2', 'Component_2' ).
get_incident( 'Incident_1' ).
get_incident( 'Incident_2' ).
index( Request ) :-
reply_html_page(
[
title('Questions')
],
[
form( [ id( search ), action(answer), method(post)],
[
h1('All Questions'),
div( [ h4('Question_1')
|\selection ]),
div( [ h4('Question_2')
|\component ]),
div( [ h4('Question_3')
|\event ]),
input( [ type( submit ), value( 'Submit' )])
])
]).
event -->
{ event( Ls ) },
html( [ div( Ls )]).
event( Ls ) :-
findall( span( [ input( [ value = Priority, name = Event, type = 'checkbox' ] ), Event ] ), get_event( Event, Priority ), Ls ).
component -->
{ component( Ls ) },
html( [ div( Ls )]).
component( Ls ) :-
findall( div( [ input( [ name = Component, value = [Type, ',', Component ], type = 'checkbox' ]), Component ]), get_component( Type, Component ), Ls ).
selection -->
{ selection( Ls ) },
html( [ div( select( Ls ))]).
selection( Ls ) :-
findall( option( [ name = Incident, value = Incident ], Incident ), get_incident( Incident ), Ls ).
现在我想将此信息用作发布参数。 我找到了 2 个解决方案, http_parameters/3 和 with member( method(post), Request)... ,但无法使其发挥作用。 如何在网站上打印所有这些参数?
【问题讨论】:
标签: html post parameters prolog swi-prolog