2014-09-15 2 views
1

나는 아마 사소한 문제라고 생각하기 때문에 누군가 나를 도울 수 있기를 바랍니다.Smalltalk html select : 가치를 어떻게 넣을 까?

renderNewForm: html 

    1 to: self anzahlFelder 
     do: 
      [:i | 
      (html textInput) 
       value: (self nameAn: i); 
       callback: [:aString | namen at: i put: aString trimBoth]. 
      (html select) 
       list: #(1 2 3);"ToDo: namen als auswahl" 
       value:(); 
       callback:[:nr| self strategien at: i put: nr]. 
       html break] 

내가 원하는 목록에서 선택한 번호 (예 : 1, 2 또는 3) 내 OrderedCollection의 strategien에 넣고 :

여기에 내 코드 추출물이다. 나는 또한 가치를 위해 무엇을 넣어야할지, 아니면 내가 필요로 할지도 모른다.

+0

나에게 잘 어울리는 ... 해변가 2 또는 3을 운영하고 있습니까? 그것은 큰 차이를 만듭니다. –

+0

값에'# (1 2 3)'을 넣으려고 했습니까? – Tobias

답변

0

정확한 문제를 설명해 주시겠습니까?
콜백이 양식에 배치되고 양식이 제출되었을 때만 실행되었다는 사실을 깨닫지 못해 좌절감에 빠졌습니다.. 여기서는 WASelectTag으로 작업 할 수 있도록 Seaside 3.1 WACounter 예제를 변경했습니다. 당신이 전략 클래스 대응하는 접근과

Object subclass: #Strategy 
    instanceVariableNames: 'nr title' 
    classVariableNames: '' 
    category: 'Demo-Seaside-Model' 

이있는 경우,

Strategy>>nr 
    ^nr 

Strategy>>nr: aNr 
    nr := aNr 

Strategy>>title 
    ^title ifNil: [''] 

Strategy>>title: aTitle 
    title := aTitle 

renderContentOn: html 

html heading: count. 
html form:[ 
    html select 
     list: #(#Increase #Decrease); 
     callback: [ :value | (value = #Increase) ifTrue: [self increase] ifFalse: [self decrease] ]. 
    html submitButton with: 'And Action!' ] 
0

및 방법은 포맷 된 문자열

을 반환 : 그냥 같이 WACounter#renderContentOn: 방법을 변경
Strategy>>selectString 
    ^(nr asString), ' - ',title asString 

당신은 WAComponent 서브 클래스가

renderChooseStrategyOn: canvas 
    canvas select 
     list: self allStrategies; 
     on: #selectedStrategy of: self; 
     labels: [ :each | each selectString]. 

그런 다음 selectedStrategy 인스턴스 변수 + 접근 및 방법 allStrategies을 필요로

을 할 수 있습니다.

관련 문제