ParentForm에서 동적 생성된 Div에 연결된 ChildForm의 함수 접근, 값 넘겨주기

heubanufi·2025년 2월 24일

Nexacro

목록 보기
5/6

ParentForm에서 동적으로 만든 Div에 set_url로 연결된 폼의 함수에 접근하는 방법

ParentForm에 동적으로 Div 생성

	var obj = new Div();
	obj.init("div_edit", 10, 10, 500, 500);
	this.addChild("div_edit",obj)
	obj.set_url("Study::ChildFrame01.xfdl");
	obj.set_background('pink');
	obj.show();

ChildForm에 fn_childForm() 함수 작성

this.fn_childForm = function (obj)
{
	this.alert(obj);
};

ParentForm에 Id로 접근

	var aa = "abcdefg"
	this.div_edit.form.fn_childForm(aa);

*주의사항
접근 시 Div에 연결된 form이 완전히 로드된 후에 접근 가능하다
완전히 로드되는 시점은 childFrame의 onload 이벤트에서 확인할 수 있다

ParentForm에서 값을 Div에 연결된 ChildForm에 넘겨주는 방법

application 변수에 담은 후 ChildForm onload 이벤트에서 application 변수를 받아 사용할 수 있다

ParentForm에 작성

	var obj = new Div();
	obj.init("div_edit", 10, 10, 500, 500);
	this.addChild("div_edit",obj)
	obj.set_url("Study::ChildFrame01.xfdl");
	obj.set_background('pink');
	obj.show();
	
	nexacro.getApplication().gv_word = "word";

ChildForm에 작성

	var word = nexacro.getApplication().gv_word;
	this.Edit02.set_value(word);

1개의 댓글

comment-user-thumbnail
2025년 7월 4일

아하~

답글 달기