Dropdown list to update database

RonaldFernandes 16 Jun, 2012
Hi,
I'm using ChronoConnectivity v4 and have a neat table that displays the records from the database.

The last column of the record is a status. I want to be able to put a dropdown menu in each row where the user can select a status from the drop down list and it will update the database with the selection. Is this possible?

Right now my Body section of the custom listing is

    
    <td align="center" valign="top">{cf_id}</td>
    <td align="center" valign="top">{Screen_Name}</td>
    <td align="center" valign="top">{RealFirstName}</td>
    <td align="center" valign="top">{CurrentEmail}</td>
    <td align="center" valign="top">{Age}</td>
    <td align="center" valign="top">{Sex}</td>
    <td align="center" valign="top">{Country}</td>
    <td align="center" valign="top">{SpokenLanguages}</td>
    <td align="left" valign="top"><div class="aboutmyself">{AboutMyself}</div></td>
    <td align="center" valign="top" width="75px">{cf_created}</td>
    <td align="center" valign="top"><div style="color:yellow;">{Status}</div> <br />
    <div style="font-size:10px; color:grey;"> update status</div>
    <select>
      <option value="Applied">Applied</option>
      <option value="Maybe">Maybe</option>
      <option value="Withdrawn">Withdrawn</option>
      <option value="After 7 days">After 7 days</option>
      <option value="Approved">Approved</option>
      <option value="Denied">Denied</option>
    </select><br /> 
    <input type="submit" value="Update" name="update" /><br /> 
    <div style="font-size:10px; color:grey; text-align:center;">updated by<br />{updatedby}</div></td>
  </tr>

Of course the drop down doesn't do anything as of now. Any tips on how to proceed?
GreyHead 16 Jun, 2012
Hi RonaldFernandes,

I can see a few ways of doing this.

1) If you have a form - as you do here - then the form has to submit to update the database table. At present, your <select> tag has no name or id and won't work. You'll need to add a name that also identifies which record is being updated and have code to make sure that the correct record is selected and updated when the form is submitted. You also have to decide if you add form tags round each mini-form - or use the form tags around the whole listing. You can't out one set of form tags inside another so this is an 'either or' choice.

2) Given that this is a mini-form you could replace the select box with a link that opens the miniform in a modal window. You'd need to pass the record id in the URL but this is easy to do. Then the miniform can be submitted, the window closed and you return to the listing.

3) If your coding is OK you could use JavaScript to submit the changed value when your drop-down changes. Again you'd need to have at least an id for the <select> tag and to identify the record to be updated.

Bob
Max_admin 19 Jun, 2012
Hi,

There is even an easier way to do this using the "Data listing" fields feature, I need to write a tutorial for that but I need to fix one or 2 things first in the next few days.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
bsanker 03 Jul, 2012
Max
How does this feature work. I have tried enabling it but my data wont save.
Max_admin 05 Jul, 2012
Hi,

For this feature to work, you will have to have the toolbar enabled in your connection, and checkboxes (selectors) enabled to tick then click the save button in the toolbar to be able to update the data, update permissions should be enabled as well.

the toolbar tasks field will look like this:
_ADD_:New,_EDIT_:Edit,_DELETE_:Remove:1,cc_save_list_data:Update State:1

However, I suggest that you wait until I prepare a tutorial on how to use it.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
KaKoRoT 11 Sep, 2012
Hi guys,

has there been any progress on this? as I would also love to get a status update feature on my form also.
Max_admin 11 Sep, 2012
Yes, the feature is now supported in the core, you will need a toolbar button for that:


_ADD_:New,_EDIT_:Edit,_DELETE_:Remove:1,_SAVE_LIST_:Update State:1


The field code should be as the following, assuming you have a field Author.email, you need this:

															<input size="25" name="ccfld_Author[email][0]" value="me@me.com" id="" type="text">
<input name="ccfld_Author[id][0]" value="42" type="hidden">													


#1- a text field, named: ccfld_Author[email][0] (where 0 is just an index)
#2- a hidden field named: ccfld_Author[id][0] (where id is the table's primary key)

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
KaKoRoT 21 Sep, 2012
Hi,

_ADD_:New,_EDIT_:Edit,_DELETE_:Remove:1,_SAVE_LIST_:Update State:1


This part I get and I now where it goes, however

This part

                                                 <input size="25" name="ccfld_Author[email][0]" value="me@me.com" id="" type="text">
    <input name="ccfld_Author[id][0]" value="42" type="hidden">                                       



I partially understand, as I know I will need to include this into the existing form and make it hidden, but I dont have a field called Author in the form, is it crucial to have this?

Also when enable the toolbar it breaks the CSS of my Menu in the website.
Max_admin 28 Sep, 2012
Hi,

A bit late, sorry!

"Author" here is the "Model ID", and email is the field name, please adjust this according to your connection settings.

Also when enable the toolbar it breaks the CSS of my Menu in the website.



Do you have the latest version ? I made some CSS changes to ensure that it doesn't conflict with other stuff in the page.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
KaKoRoT 30 Sep, 2012
Thanks, will add the model ID and make the required changes!!

new version, I will get this install right away!! thanks again!!
KaKoRoT 01 Oct, 2012
Hi,

Unfortunately this has not helped.

So Perhaps I am doing this wrong.

I have added the to the "Code", "HTML code" section of form. (didn't see an option to add to the form wizard) Wrong or right?

<input size="25" name="ccfld_testmodel[email_address][0]" value="me@me.com" id="" type="text">
<input name="ccfld_testmodel[id][0]" value="42" type="hidden">


Adding this part to the toolbar in the "Front End List Settings"
_ADD_:New,_EDIT_:Edit,_DELETE_:Remove:1,cc_save_list_data:Update State:1

but now the toolbar appears inside the form results, (i can probably fix this with some css) but the buttons on press go to a blank page.

Any ideas?

Edit: sorted out the CSS, but i am sure there is a misunderstanding here, as all I need to do is have another field called called "status" and be able to set it to "completed" or not "completed".
KaKoRoT 01 Oct, 2012
Ok I have noticed what to do,

[list]
- however is it possible to put a dropdown list in the actual "Data listing Field(s)" section it self?
- prevent the page going blank when edit, add and remove is pressed.
[/list]

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