0

I'm using the Solspace User v3.4.4 module on Exp Eng v2.7.2 - Build Date: 20131008 and trying to provide a set of existing Avatars for members to select from. I've setup a javascript function that populates a hidden field with the filename of the Avatar image when it is clicked on in a displayed list. But when the User "edit" profile form is updated the value is not being saved/stored in the member's profile.

I've tried variations of the field from 'hidden' to 'file' to 'text'. I can see the field being set to the proper value on the web page when a radio button is clicked on. But no saving of the field value when the form is posted. It seems likely there is some other security issue blocking this or something that I'm missing.

Here's some of the html and javascript... (I've changed the initial character of some tags to '[' so that the code will display)

[p id="avatar_filename_set">Choose a New Avatar: [input type="text" name="avatar_filename" id="avatar_filename" value="" /> [input type="hidden" name="XID" value="{XID_HASH}">

<table border="0" cellpadding="3" cellspacing="3" style="width:100%;">
<tr>
<td align='center'><img src='{site_url}images/avatars/sports/stand-up-paddling.png' border='0' alt='stand-up-paddling.png'/><br />
<input type='radio' name='avatar' value='stand-up-paddling.png' {if avatar_filename == 'sports/stand-up-paddling.png'}checked='checked'{/if} onclick="javascript:document.getElementById('avatar_filename_set').getElementsByTagName('input')[0].value = 'sports/stand-up-paddling.png'; return false;" /></td>

Here is the javascript specifically...

onclick="javascript:document.getElementById('avatar_filename_set').getElementsByTagName('input')[0].value = 'sports/stand-up-paddling.png'; return false;"

Any ideas would be appreciated. Thanks.

1

The avatar_filename field is a file type field, and therefore only accepts a file upload (see the example in the documentation). You cannot submit string data to the avatar_filename field (through a text or hidden field for example), since the field expects not the filename, but an actual file attached to the field. Also, in HTML, you cannot submit a string of data (eg. a filename) as a value for a file field type.

To summarize, it's not possible.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.