Results 1 to 3 of 3

Thread: How to load radio elements from an ajax?

  1. #1
    Sencha User axelaxel's Avatar
    Join Date
    Sep 2008

    Default How to load radio elements from an ajax?

    hi guys
    i would like to know how is it possible to load radio elements from an ajax called, a proxy, anyway i need to load element list from php

    i don't need to set radio buttons elements seeting them like this
                         items: [
                             {boxLabel: 'Item 1', name: 'rb-auto', inputValue: 1},
                             {boxLabel: 'Item 2', name: 'rb-auto', inputValue: 2, checked: true},
                             {boxLabel: 'Item 3', name: 'rb-auto', inputValue: 3},
                             {boxLabel: 'Item 4', name: 'rb-auto', inputValue: 4},
                             {boxLabel: 'Item 5', name: 'rb-auto', inputValue: 5}

    any help?
    i searched on the forum but i wasn't able to find any solutions

    thank you

  2. #2
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Haan, Germany
    vg Steffen
    Release Manager of TYPO3 4.5

  3. #3


    Not so fast ... what axelaxel wants to do is to set the items.

    Well, one thing that I've begun to do a lot lately is to download source-code from the server by means of e.g. a <script> tag. The tag points to (say...) a php-script which returns computer-generated JavaScript.

    Generating such things is much easier than you might think: the JSON encoding of a data structure is JavaScript. Therefore, you simply stick "foobar =" in front of it, and ";" after it, and you're done. Just make sure that you use that script-tag early in the file.

    Now, you indeed do have access to parameter values that originated from the server: it's just that they are now "part of your code." JavaScript source-code after all neither knows nor cares "where or how or when" it came to be on the client's computer.


    If you find yourself firing an AJAX request "at startup" to get a certain bit of necessary information (as I did...), this does the same thing, in a better way, and it is much more .


    To specifically address your problem now, Axel, "now that you magically have the necessary information right there in a variable (e.g. foobar), you simply need to refer to it in the initialization code of your form. You will construct the contents of the items array dynamically. (I don't think that I would ask the PHP side to ship you "ready-to-use ExtJS data structures." That's a bit lazy ... actually, "more difficult to maintain.")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts