我想选择一个带有<g:select>
标记的语言,并在选择更改时将选择参数发送到某个操作。 (帕拉姆应在打开视图的URL中可见)g:选择onchange with rest-url
我试图和<g:form>
不同的变化<g:select>
:
版本创建正确的参数,可以但不创建一个REST URL :
<g:form name="selectLanguage" <b>action='show' id="${mitarbeiterprofilInstance.id}" lang=lang> <g:select onchange="submit();" value="${profilInstance?.sprache?.sprache}" name="lang" optionKey="sprache" optionValue="sprache" from = "${mitarbeiterprofilInstance.profiles.sprache}" /> </g:form>
PARAMS:
[lang:deutsch, id:3, action:show, controller:mitarbeiterprofil]
网址:
/mitarbeiterprofil/show/3
网址应该是
/mitarbeiterprofil/show/3/deutsch
版本增加了PARAMS的url,但与错误的行动:
<g:form name="selectLanguage" id="${mitarbeiterprofilInstance.id}" lang=lang> <g:select onchange="submit();" value="${profilInstance?.sprache?.sprache}" name="lang" optionKey="sprache" optionValue="sprache" from = "${mitarbeiterprofilInstance.profiles.sprache}" /> </g:form>
PARAMS:
[lang:deutsch, id:3, action:index, controller:mitarbeiterprofil]
网址:
/mitarbeiterprofil/index/3/deutsch
版本选择合适的控制器,显示在URL中的参数,可以但不使用正确的参数:
<g:form name="selectLanguage" id="${mitarbeiterprofilInstance.id}" lang=lang> <g:select onchange="submit(<b>action='show');" value="${profilInstance?.sprache?.sprache}" name="lang" optionKey="sprache" optionValue="sprache" from = "${mitarbeiterprofilInstance.profiles.sprache}" /> </g:form>
PARAMS:
[lang:show, id:3, action:show, controller:mitarbeiterprofil]
网址:
/mitarbeiterprofil/show/3/show
有谁还有另一个想法,我可能会怎么做呢?
嗨,ive在你的代码中做了Url-Mappings,但没有效果...只有通过直接通过url或其他视图访问操作才能显示正确的Url,但不能使用g:select。 – fabschu