Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Kolja
Posts: 2
Registered: ‎05-10-2010
My Device: 9800

radiobutton onClick->Submit not sending values

Hello!

 

I am facing some strange behavior of the BlackBerry Browser on newer devices (9800 and 8900 tested).

Within a Webapp we have been using for years on all kinds of BlackBerry devices a set of radio buttons exist using the folowing code:

 

 

...
<td>
<input name="variante" value="600" checked onclick="document.getElementById('action').value='artikeldetail';this.form.submit();"
 type="radio">
</td>
</tr>
<tr><td>660</td><td>Farbe 660</td>
<td><input name="variante" value="660" 
onclick="document.getElementById('action').value='artikeldetail';this.form.submit();"
 type="radio">
</td>
</tr>
<tr><td>670</td><td>Farbe 670</td><td><input 
checked="checked" name="variante" value="670" 
onclick="document.getElementById('action').value='artikeldetail';this.form.submit();"
 type="radio">
</td>
...

Whenever one of the radio buttions is clicked, the form submits, but the value of "variante" is always "600".

If I remove the preselection by removing "checked" from the first radiobutton, the browser doesn't send a value for "variante" in its POST request at all.

 

It seems as if the form was submitted prior to setting the value of the clicked radio button.

 

Has anyone experienced similar behavior on 4.6 devices?

Is there anything I can do to force the device to send the value?

 

Kind regards,

 

Kolja

 

 

New Contributor
Kolja
Posts: 2
Registered: ‎05-10-2010
My Device: 9800

Re: radiobutton onClick->Submit not sending values

I looked a little further into this issue and realized the problem is with the onClick  thats used.

OS 4.6 devices execute onClick before the value of the input element is changed. Those devices work fine when onChange is used instead.

 

However, OS 4.5 and lower devices do not support onChange and thus don't submit the form when onChange is used.

 

Using both onChange and onClick in each input tag works on <4.6 devices, but newer devices will still execute the onClick and not change the value.

 

As a workaround I am going to use a hidden field and set its value within the onCloick event.

 

Still I'm curious to know, what a best practice suggestion of RIM would look like.