Dynamic Dropdown Issues

bhardwajd 07 Feb, 2012
I have also got a query regarding the dynamic drop down box. I am a novice in chronoforms and is trying to use dynamic dropdown in which both the source and target select box values are taken from the database.

Source drop down is a custom element with following code to fill in the values :
<div class="ccms_form_element cfdiv_select" id="label_text_container_div"><label>Select Salesman</label><select size="1" label_over="0" hide_label="0" class=" validate['required']" title="" type="select" name="salesman" id="salesman">
        <option value="0">Choose Salesman</option>
        <?php
        $db =& JFactory::getDBO();
        $query = "
          SELECT *
            FROM #__users where id<100 order by name";
        $db->setQuery($query);
        $rows = $db->loadObjectList();


    foreach ($rows as $row) {
          echo "<option value='$row->id'>$row->name</option>";
    }
        ?>
        </select>
<div class="clear"></div><div id="error-message-salesman"></div></div>


where as the target drop down is normal select box.

I have added dynamic drop down as the first option in on load event and then created a new event by the name of ajax in which a custom code is put to fetch values to second drop down. Screen shots of both are attach. Please help in solving this issue. Second drop down is not getting the values through the ajax. I tried using the action provided by greyhead for the very same purpose but the result is still the same
GreyHead 07 Feb, 2012
Hi bhardwajd,

Where exactly does it fail? Are there any JavaScript errors on the page?

Bob
bhardwajd 11 Feb, 2012
No it doesn't give any errors. it simply doesnt work
GreyHead 11 Feb, 2012
Hi bhardwajd,

Then it's up to you to work out why it doesn't work. Use the web developer tools in your browser to see if there are any JavaScript errors being reported and what, if anything, is being returned from the Ajax query.

Bob
Max_admin 15 Feb, 2012
Hello,

Just a note here, I have this line in the "Help" tab in the "Dynamic drop down" action:

The new event output should be in multi line format, example:
value1=Title 1
value2=Title 2
value3=Title 3



But you are feeding it with a full "Select" element HTML code, of course this will not work then, so please change your PHP to generate the correct output.

Also, you are using a full Select Query to get some results from a table, then why do we have a "Multi record loader" action ? this is not harmful but it would save your time of course🙂

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
primetime18007 02 Apr, 2012
What if the Browser output a blank page when using either the dynamic dropdown or Ajax enabled dropdown
add on that you have on greyhead.net? Everything works fine until those actions are added.

I have it set up similar to the screen shots above and had it setup as per the instructions on the help tabs but nothing works when either of those actions are applied.

I'm new to Chronoforms so the help seems confusing, I am even waiting on the $5 CF using ajax help manual I bought (waiting on Paypal?) to help me figure this out.

Any guidance would be appreciated.

-Mike
GreyHead 02 Apr, 2012
Hi Mike,

Browser pages that are completely blank are usually a sign of a PHP error, if you temporarily set site Error Reporting to Maximum in the Site Global Configuration you may well see a more useful message.

Bob
primetime18007 03 Apr, 2012
Thanks for the prompt reply and the suggestion, Bob.

So I think its me not knowing where to put the php part.
Dynamic Dropdown Issues image 1

At first I had it on the On Load event (1)...probably wrong. SO I re-read the directions and tried creating a new event as the help pop-up on the ajax dropdown suggested and added the custom code element to it (2) similar to the help suggestions.

I have the form back in the browser now, but it is still not working. Am I missing the order or not reading the help right?

-Mike

ps. I did try it this way with that ajax add on and the other dynamic dropdown action.
GreyHead 10 Apr, 2012
Hi Mike,

Use the Add Event button to create a new event for the PHP.

Bob
darkstar2000 02 Aug, 2012
Hello, I'm using Chronoform 4 (the latest release) but the Dynamic Dropdown action doesn't work!!!

If I inspect the HTML code generated by the form using Dynamic Dropdown action, there isn't the javascript code that invoke the event specified in the Dynamic Dropdown action, where I've inserted my custome PHP code...

Someone can explain to me "why" and can help me to correct/resolve the problem?

Sorry for my bad english, have a nice day!
GreyHead 02 Aug, 2012
Hi darkstar2000,

There's probably a JavaScript error on the page. Please post a link to the form so I can take a quick look.

There is no JavaScript included in the HTML. it's in a separate script snippet included in the page.

Bob
This topic is locked and no more replies can be posted.