Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Copper Super Contributor
Posts: 26
Registered: ‎04-14-2009

Javascript validation without creating a custom smartpart



Is there a way to create validation wiht Javascript inside of Application Architect without having to create a custom smartpart?


I like the results of using Javascript but I would like to be able to do the work inside of Application Architect.


Thank You,


Michael Stoler

Nickel Contributor
Posts: 57
Registered: ‎03-18-2010

Re: Javascript validation without creating a custom smartpart



you can add on each input control an "Attribute" (control.Attributes.Add(event, jscript))




yourtextboxcontrol.Attributes.Add("onblur","Alert('Fires when you leave the control');");


See you

Libert Damien
Bronze Super Contributor
Posts: 129
Registered: ‎06-09-2009

Re: Javascript validation without creating a custom smartpart

Yes, but.....


It makes the Development cycle a lot longer.


For starters:

- Deploy your site without Compilation

- Write your javscript (put it on a linked file), not directly on the form.

- Figure out the code needed to associate Events to your Controls.


Once you have figured it all out and tested it, then:

- Add your Javascript file to App Architect (under Support Files)

- On your Form, add a Load action where you add code for:

  a) Link your Javascript file

  b) Associate your controls and Events.



I typically run on the form code to create Java variables containing references to the controls (again, keeping in mind that thay are composite controls and knowing which internal item to choose from):


  e.g. string scr = "var objStatusPicklist = document.getElementById('" + plStatus.ClientID + "_TXT');";


Then, on the script file, I have an OnReady function that associates my Event, the Custom Handler, My Add event handler function, etc


OnReady func


 AddEventHandler(objStatusPicklist, "onBlurCustomHandler");




So, it is doable; but I would only do it for Presentation purposes, I wouldn't do all actual development this way. (Otherwise, testing every change would require to do a Build and Redeploy, taking hours to do what could be done in minutes).

Raul A. Chavez