Hi samith

Something like following would wrk

var dElement = $("<div></div>");
dElement.load('js/pathto/yourForm.html');

or

$.ajax({
url : "js/pathto/yourForm.html",
success : function(result){
$('#yourDiv').html(result);
  }
 });

You can execture the script related to those htmls files as well.
But may fail in some browsers.

Thanks



On Wed, Aug 13, 2014 at 10:21 AM, Dakshika Jayathilaka <[email protected]>
wrote:

> Hi,
>
> if your using jquery, you can use $.getScript() [1] for this type of
> dynamic js loading.
>
> [1] http://api.jquery.com/jQuery.getScript/
>
> *Dakshika Jayathilaka*
> Software Engineer
> WSO2, Inc.
> lean.enterprise.middleware
> 0771100911
>
>
> On Wed, Aug 13, 2014 at 2:41 AM, Udara Rathnayake <[email protected]> wrote:
>
>> Hi Samitha,
>>
>>
>> On Tue, Aug 12, 2014 at 10:27 AM, Samith Dassanayake <[email protected]>
>> wrote:
>>
>>> Hi,
>>> I have a form with a drop down element. Based on the selected value of
>>> the drop down I want to dynamically add form elements from a another file,
>>> which contains the remaining form elements and validation functions for
>>> those elements.
>>>
>>
>> Why do you need to keep separate files? Since these are just form
>> elements you can dynamically generate these fields and render. Are these
>> validation functions specific to this scenario?
>> If there are common stuff you should keep those away from front-end HTML
>> so you can re-use.
>>
>>
>>>  For each value in the drop down, we have a separate file which
>>> contains the remaining part of the form and validation function based on
>>> the selected drop down value.
>>> Is it possible to dynamically load elements and functions as above
>>> scenario? If is it possible what the best way to do it?
>>>
>>> Thanks
>>>
>>> --
>>> Best Regards
>>>
>>> Samith Dassanayake
>>> Software Engineer, WSO2 Inc.
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Udara Rathnayake*
>> Software Engineer
>> WSO2 Inc. : http://wso2.com
>>
>> Mobile : +94 772207239
>> Twitter : http://twitter.com/udarakr
>> Blog    : http://udarakr.blogspot.com
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Susinda Perera*
Software Engineer
Mobile:(+94)716049075

WSO2 Inc. http://wso2.com/
Tel : 94 11 214 5345 Fax :94 11 2145300
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to