Android Question Checkbox value post with http2utils

holdemadvantage

Active Member
Licensed User
Longtime User
Hi all,

i have a layout in which i insert data to post to a web admin area
Data is a checkbox which can be set True (selected) or false (not selected)

Than a button containing this code

in this way

B4X:
If checkbox1.Checked=True Then
valoregi="checked"
Else
valoregi="0"
End If

Jobregister.Initialize("Jobregister", Me)
Jobregister.PostString("http://www.mydomain.com/register.asp", "x_checkbox=" & valoregi)

Input type into webpage register.asp is

B4X:
<input type="checkbox" data-field="x_checkbox" name="x_checkbox" id="x_checkbox" value="1">
if checkbox is not selected

and
if it is selected code into register.it looks like
B4X:
<input type="checkbox" data-field="x_checkbox" name="x_checkbox" id="x_checkbox" value="1" checked="checked">


but it doesn't work, i cannot transmit to website (and update my web database)

Could you please suggest me the way to solve my problem?
 

holdemadvantage

Active Member
Licensed User
Longtime User
Hi Erel, yes, register.asp holds the form but the code inside is a little bit more complex than the one i showed in my post

The request is

B4X:
Jobregister.Initialize("Jobregister", Me)
Jobregister.PostString("http://www.omahabrain.com/sisalapp/register.asp", "t=Tabella1" & "&a_register=A" & "&x_Cognome=" & cogreg.Text & "&x_Nome=" & nomereg.Text & "&x_Username=" & userreg.Text & "&x_Password=" & passreg.Text & "&c_Password=" & cogreg.Text & "&x_zEmail=" & mailreg.Text & "&x_Registrato_a_Sisal3Fl=" & valoregi)

and the code of the form is

B4X:
<form name="fregister" id="fregister" class="ewForm form-horizontal" action="<%= ew_CurrentPage %>" method="post">
<input type="hidden" name="t" value="Tabella1">
<input type="hidden" name="a_register" id="a_register" value="A">
<table cellspacing="0" class="ewGrid"><tr><td>
<table id="tbl_register" class="table table-bordered table-striped">
<% If Tabella1.Cognome.Visible Then ' Cognome %>
    <tr id="r_Cognome">
        <td><span id="elh_Tabella1_Cognome"><%= Tabella1.Cognome.FldCaption %></span></td>
        <td<%= Tabella1.Cognome.CellAttributes %>>
<span id="el_Tabella1_Cognome" class="control-group">
<input type="text" data-field="x_Cognome" name="x_Cognome" id="x_Cognome" size="30" maxlength="255" placeholder="<%= Tabella1.Cognome.PlaceHolder %>" value="<%= Tabella1.Cognome.EditValue %>"<%= Tabella1.Cognome.EditAttributes %>>
</span>
<%= Tabella1.Cognome.CustomMsg %></td>
    </tr>
<% End If %>
<% If Tabella1.Nome.Visible Then ' Nome %>
    <tr id="r_Nome">
        <td><span id="elh_Tabella1_Nome"><%= Tabella1.Nome.FldCaption %></span></td>
        <td<%= Tabella1.Nome.CellAttributes %>>
<span id="el_Tabella1_Nome" class="control-group">
<input type="text" data-field="x_Nome" name="x_Nome" id="x_Nome" size="30" maxlength="255" placeholder="<%= Tabella1.Nome.PlaceHolder %>" value="<%= Tabella1.Nome.EditValue %>"<%= Tabella1.Nome.EditAttributes %>>
</span>
<%= Tabella1.Nome.CustomMsg %></td>
    </tr>
<% End If %>
<% If Tabella1.Data_di_Nascita.Visible Then ' Data di Nascita %>
    <tr id="r_Data_di_Nascita">
        <td><span id="elh_Tabella1_Data_di_Nascita"><%= Tabella1.Data_di_Nascita.FldCaption %></span></td>
        <td<%= Tabella1.Data_di_Nascita.CellAttributes %>>
<span id="el_Tabella1_Data_di_Nascita" class="control-group">
<input type="text" data-field="x_Data_di_Nascita" name="x_Data_di_Nascita" id="x_Data_di_Nascita" placeholder="<%= Tabella1.Data_di_Nascita.PlaceHolder %>" value="<%= Tabella1.Data_di_Nascita.EditValue %>"<%= Tabella1.Data_di_Nascita.EditAttributes %>>
</span>
<%= Tabella1.Data_di_Nascita.CustomMsg %></td>
    </tr>
<% End If %>
<% If Tabella1.Username.Visible Then ' Username %>
    <tr id="r_Username">
        <td><span id="elh_Tabella1_Username"><%= Tabella1.Username.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></span></td>
        <td<%= Tabella1.Username.CellAttributes %>>
<span id="el_Tabella1_Username" class="control-group">
<input type="text" data-field="x_Username" name="x_Username" id="x_Username" size="30" maxlength="255" placeholder="<%= Tabella1.Username.PlaceHolder %>" value="<%= Tabella1.Username.EditValue %>"<%= Tabella1.Username.EditAttributes %>>
</span>
<%= Tabella1.Username.CustomMsg %></td>
    </tr>
<% End If %>
<% If Tabella1.Password.Visible Then ' Password %>
    <tr id="r_Password">
        <td><span id="elh_Tabella1_Password"><%= Tabella1.Password.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></span></td>
        <td<%= Tabella1.Password.CellAttributes %>>
<span id="el_c_Tabella1_Password" class="control-group">
<input type="text" data-field="x_Password" name="x_Password" id="x_Password" size="30" maxlength="255" placeholder="<%= Tabella1.Password.PlaceHolder %>" value="<%= Tabella1.Password.EditValue %>"<%= Tabella1.Password.EditAttributes %>>
</span>
<%= Tabella1.Password.CustomMsg %></td>
    </tr>
<% End If %>
<% If Tabella1.Password.Visible Then ' Password %>
    <tr id="r_c_Password">
        <td><span id="elh_c_Tabella1_Password"><%= Language.Phrase("Confirm") %>&nbsp;<%= Tabella1.Password.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></span></td>
        <td<%= Tabella1.Password.CellAttributes %>>
<span id="el_c_Tabella1_Password" class="control-group">
<input type="text" data-field="c_Password" name="c_Password" id="c_Password" size="30" maxlength="255" placeholder="<%= Tabella1.Password.PlaceHolder %>" value="<%= Tabella1.Password.EditValue %>"<%= Tabella1.Password.EditAttributes %>>
</span>
</td>
    </tr>
<% End If %>
<% If Tabella1.zEmail.Visible Then ' Email %>
    <tr id="r_zEmail">
        <td><span id="elh_Tabella1_zEmail"><%= Tabella1.zEmail.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></span></td>
        <td<%= Tabella1.zEmail.CellAttributes %>>
<span id="el_Tabella1_zEmail" class="control-group">
<input type="text" data-field="x_zEmail" name="x_zEmail" id="x_zEmail" size="30" maxlength="255" placeholder="<%= Tabella1.zEmail.PlaceHolder %>" value="<%= Tabella1.zEmail.EditValue %>"<%= Tabella1.zEmail.EditAttributes %>>
</span>
<%= Tabella1.zEmail.CustomMsg %></td>
    </tr>
<% End If %>
<% If Tabella1.Registrato_a_Sisal3F.Visible Then ' Registrato a Sisal? %>
    <tr id="r_Registrato_a_Sisal3F">
        <td><span id="elh_Tabella1_Registrato_a_Sisal3F"><%= Tabella1.Registrato_a_Sisal3F.FldCaption %></span></td>
        <td<%= Tabella1.Registrato_a_Sisal3F.CellAttributes %>>
<span id="el_Tabella1_Registrato_a_Sisal3F" class="control-group">
<% selwrk = ew_IIf(ew_ConvertToBool(Tabella1.Registrato_a_Sisal3F.CurrentValue), " checked=""checked""", "") %>
<label class="checkbox"><input type="checkbox" data-field="x_Registrato_a_Sisal3F" name="x_Registrato_a_Sisal3F" id="x_Registrato_a_Sisal3F" value="1"<%= selwrk %><%= Tabella1.Registrato_a_Sisal3F.EditAttributes %>></label>
</span>
<%= Tabella1.Registrato_a_Sisal3F.CustomMsg %></td>
    </tr>
<% End If %>
</table>
</td></tr></table>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><%= Language.Phrase("RegisterBtn") %></button>
</form>


checkbox filed that doesn't update is x_Registrato_a_Sisal3F

Thanks for your feedback
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
FireBug or any similar tool can be very helpful in such cases.

You can see the request here:
SS-2013-11-17_08.46.24.png
 
Upvote 0

holdemadvantage

Active Member
Licensed User
Longtime User
Thanks a lot Erel :) i have to check FireBug asap :)

First of all i add a char in feld name (i used x_Registrato_a_Sisal3Fl in the request instead of x_Registrato_a_Sisal3F)
and then i didn't understand which value x_Registrato_a_Sisal3F had to be (i tried "1" and "checked" but i had to use an integer 1 or 0 :) :) )

Thanks again for your help!!
 
Upvote 0
Top