Skip to Content Skip to Menu

qurymultiselect

  • pmeakins
  • pmeakins
  • OFFLINE
  • Posts: 7
  • Thanks: 0
  • Karma: 0
10 years 1 month ago - 10 years 1 month ago #249039 by pmeakins
qurymultiselect was created by pmeakins
Hi,

I have a querymultiselect which is causing some issues when the innerhtml of the select is updated from Ajax.

I first start with a blank select, and when the user enters a value in a different field there is a trigger to update the dropdown which works fine, the contents on the <select is basic no grouping, only two rows with values 1,2

After I make a select and save there is no change to the profile, I see the _POST from comprofiler.class.php so confirm that the multiselect values were selected.

However, on the admin/saveSafely function 'edit' the values have been removing and so when the record is saved the field is now blank.

Anyone got any ideas as to why I can not save and updated select.

I have added as a default 2 rows testa,testb with values 1,2 If I go a head and Ajax the content and update the list keep if I set a value to the same as the default this works fine, as soon as I change the 'value' nothing is saved, really struggling on this.

I was looking for the actial save 'from when I edit' so I can see the exact sql query to see its contents.

Via joomla debug I see the query which the value ''.

If I can find the UPDATE #__com... sql then I can work backwards to see why the values are being dropped.

Received into saveSafely ( [cb_companylink] => Array ( [0] => 5 [1] => 2 )
and $this [cb_companylink] => - from library/cb/cb.tables.php
Last edit: 10 years 1 month ago by pmeakins.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 1 month ago - 10 years 1 month ago #249094 by krileon
Replied by krileon on topic qurymultiselect
CB has protection against injections like that. You can't just add options with jQuery and they store otherwise anyone could easily edit the DOM and add whatever they want. CB runs prepareFieldDataSave (field save function), which checks that the values sent in the POST actually exist in the field. Your ajax usage needs to be properly built into CB Query Field using the Ajax response endpoint (fieldClass field function) to properly rebuild the list of options.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 10 years 1 month ago by krileon.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum