2

I have a dropdown which has a value saved from the database. The problem is, when I go to the page to view the values it returns to the default. Here are my screenshots:

On my 1st image, it displays an alert message showing the subscription type's value.

enter image description here

Right after clicking OK in the alert box, the value of the dropdown subscription type is reset to blank. Please see 2nd image for reference :

enter image description here

here is a screenshot of the inspect element of the dropdown list. In the inspect element, it actually has a value selected:

enter image description here

When I refresh the page, the actual value then displays but in the alert message, it does not get the value. Please see 4th image for reference: enter image description here

Now when I try to click submit, a validation message displays for the subscription_type dropdown list stating that it does not have a value when in fact it does. Please see 5th picture for reference :

enter image description here

Any thoughts? please pardon the long post due to the pictures. I need to post pics for clearer understanding of the problem. Also, I do not have any code specialized for the dropdown value so I'm wondering why it is working it like that.

If anything, here is the dropdown list's code in the .xml form:

 <field name ="subscription_type" type="list" 
    label="Subscription Type"
        description="Type of Subscription either Regular or Special"
        option_on ="Yes"
        option_off ="Yes"
        default = ""
        required="true"             
        >

        <option value = "">- Select Subscription Type -</option>
        <option value ="RDS">RDS</option>
        <option value ="SDS">SDS</option>

    </field>
  • 1
    if you view the source of the page (so that javascript doesn't affect anything), is it listed with selected="selected". If so, we at least know that we are tracking a javascript and not a PHP issue. Since I think that is the case, the question becomes, are you using anything different to style or add features using javascript to the form? – David Fritsch Jan 19 '15 at 2:01
  • I am not using anything different to add javascript to my code. – Break the Law Jan 20 '15 at 0:50
  • I found out the source of the error. Turns out it was from the javascript code which sets the subscription type to its default value. Already fixed. Thanks for your insight! – Break the Law Jan 20 '15 at 1:03
0

Please refer to this page https://docs.joomla.org/List_form_field_type and specifically this sentence:

value (mandatory) is the value that will be saved for the field if this item is selected.

Try adding a value to your first option, perhaps '0'.

  • already tried that. still the same issue. – Break the Law Jan 20 '15 at 0:53
0

Found the issue. Turns out I was setting the value of the subscription type field instead of another field which I was supposed to blank out in a separate javascript file.

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.