Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi,
I am creating a user's profile with 2 securefile in it. but when creating a user from admin panel it is throwing PHP error as follows:
Warning: count(): Parameter must be an array or an object that implements Countable in C:\wamp64\www\projectname\couch\addons\data-bound-form\securefile.php on line 203


I have tested deleting either of securefile but throwing same error.

securefile code:
Code: Select all
   <cms:editable
        name='display_img'
        label='Display Image'
        type='securefile'
        allowed_ext='png, jpg, jpeg'
        max_size='2048'
        crop='1'
        thumb_width='300'
        thumb_height='300'
        show_preview='1'
        use_thumb_for_preview='1'
        thumb_quality='100'
/>

Code: Select all
<cms:editable type='securefile' name='doc' label='Document' not_active=a_cond order='90'  allowed_ext='pdf, doc, docx'  max_size='4048'  />


Attaching a screenshot of error.
couch-error.png
couch-error.png (96.58 KiB) Viewed 1095 times


some side effects:
In the same user's profile I have two types of user and fields are conditionally changing according to type of user.
Code: Select all
    <cms:editable
        name="user_type"
        label="User Type"
        desc="Type of user"
        opt_values='A | B'
        type='radio'
        required='1'
        order='20'
/>

<cms:func _into='b_cond' user_type=''>
        <cms:if user_type='b' >
            show
        <cms:else />
            hide
        </cms:if>
</cms:func>
<cms:func _into='a_cond' user_type=''>
        <cms:if user_type='A' >
            show
        <cms:else />
            hide
        </cms:if>
</cms:func>


Fields are perfectly working in admin panel but when using it with databound form in front end and
updating the profile field based on user type it is throwing error of required field of other type of user.
example:
user_type=A : some field specific to type A user
user_type=B : some field specific to type B user with some required fields
Updating Profile of user_type A but throwing error that required fields cannot be empty which in fact belongs to user_type B
However, this error is not happening in the case of superuser but conditional fields are not updating with data-bound form (type=bound).

steps to reproduce
1. Activate extended user and databound-forms
2. Create editable of type securefile inside user's template (users/index.php)
3. go to admin panel and add new user.

edit 1:
even tried with simple clonable template (not user template) , still getting the error
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='profle' clonable='1'>
      <cms:editable
        name='display_img'
        label='Display Image'
        type='securefile' />
</cms:template>
<?php COUCH::invoke(); ?>   


edit 2:
Downloaded the databound form demo (job application demo) from databound documentation and imported the project on brand new couch from git and everything worked like charm but imported the same files in advance tutorial (notejam application) and again throwing the same error.

edit 3:
PHP warning has gone with the lastest couch from git. But what I was thinking side effects still persist. I cannot save data through data-bound form through the input of type bound for the conditional field. Now I am doubting my conditions got some error! I am able to change the non-conditional field from the data-bound form but not able to change conditional field. (conditions are perfectly working in admin panel)
attaching form code:
Code: Select all
<cms:form
    masterpage=k_user_template
    mode='edit'
    page_id=k_user_id
    enctype="multipart/form-data"
    method='post'
    anchor='0'
    class="dashboard-form">
...
...
...

Any light on this issue from KK sir would be appreciated!
Thanks
Hi,

The warning (as you have already found out) had been fixed sometime back.

As for the other problem, since things are working fine in the admin-panel I'd expect the same on the frontend too (the admin-panel also uses a DBF).

Anyway, please PM me your template and I'll take a look.
KK wrote: Hi,

The warning (as you have already found out) had been fixed sometime back.

As for the other problem, since things are working fine in the admin-panel I'd expect the same on the frontend too (the admin-panel also uses a DBF).

Anyway, please PM me your template and I'll take a look.



PM sent!
3 posts Page 1 of 1
cron