Hi,
I have been looking for a few hours why this worm will not save data.
I checked on the HTML side and it looks perfect. How I did this was to past the form to https://httpbin.org/post
The result is
When I post to the server, I can see the length is different depending on what I type
But the map is not filled. I used this code to read it before and populate the DB
It seems like the data is coming through but I cannot find the method of extracting it
Maybe it is a Sunday problem.
I am using HTMX to swap out the Select Areas and also to SWAP out the Searchable Fields.. I tried Choices.js but found it was not working for me as I had more than one field to use the plugin and it would not support that. So I eventually used datatables
Thank you
I have been looking for a few hours why this worm will not save data.
I checked on the HTML side and it looks perfect. How I did this was to past the form to https://httpbin.org/post
The result is
{
"args": {},
"data": "",
"files": {},
"form": {
"addressInput": "95 Ridgeside Road, Durban North",
"contactInput": "Peter Lewis",
"descriptionTextarea": "description test",
"emailInput": "peter@praxos-software.co.za",
"mallnameInput": "Gateway",
"municipalitySelect": "Ethekwini",
"ownerSelect": "9f8ff690-5034-46a0-bc0c-c4a3b299c6ca",
"phoneInput": "0724533919",
"postalcodeInput": "4051",
"postersInput": "20",
"provinceSelect": "KWAZULU-NATAL",
"retailshopsInput": "100",
"suburbSelect": "Durban NU",
"websiteInput": "https://www.home.co.za"
},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Accept-Language": "en-US,en;q=0.9,en-ZA;q=0.8",
"Cache-Control": "max-age=0",
"Content-Length": "423",
"Content-Type": "application/x-www-form-urlencoded",
"Dnt": "1",
"Host": "httpbin.org",
"Origin": "http://127.0.0.1:5000",
"Priority": "u=0, i",
"Referer": "http://127.0.0.1:5000/",
"Sec-Ch-Ua": "\"Not:A-Brand\";v=\"99\", \"Google Chrome\";v=\"145\", \"Chromium\";v=\"145\"",
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "\"Windows\"",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "cross-site",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36",
"X-Amzn-Trace-Id": "Root=1-69b6dd10-5a79734210704ebc37600f25"
},
"json": null,
"origin": "169.1.***.***",
"url": "https://httpbin.org/post"
}
When I post to the server, I can see the length is different depending on what I type
clsMallInfoAdd
length 396
Type application/x-www-form-urlencoded
Full Request URL http://127.0.0.1:5000/malladd
Input Stream (HttpInput) HttpInput@148891937 cs=HttpChannelState@503fbbc6{s=HANDLING rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0} cp=org.eclipse.jetty.server.BlockingContentProducer@55f45b92 eof=false
Methods POST
Request URI /malladd
Secure ? false
(MyMap) {}
Methods POST
But the map is not filled. I used this code to read it before and populate the DB
B4X:
Dim query As String = utils.prepareInsertQuery($"
INSERT INTO [ledposter].[dbo].[malls](
[mallID]
,[mallName]
,[province]
,[city]
,[postalcode]
,[phone]
,[email]
,[ownerID]
,[suburb]
,[description]
,[retailshops]
,[posters]
,[status]
,[mtraffic]
)"$)
Dim guidST As JavaObject
guidST.InitializeStatic("java.util.UUID")
Dim guid As JavaObject = guidST.RunMethod("randomUUID",Null)
Dim guidStr As String = guid.RunMethod("toString",Null)
Dim params(query.Length - query.Replace("?","").Length) As String
params(0) = guidStr
params(1) = req.GetParameter("mallnameInput")
params(2) = req.GetParameter("provinceSelect")
params(3) = req.GetParameter("municipalitySelect")
params(4) = req.GetParameter("postalcodeInput")
params(5) = req.GetParameter("phoneInput")
params(6) = req.GetParameter("emailInput")
params(7) = req.GetParameter("ownerSelect")
params(8) = req.GetParameter("suburbSelect")
params(9) = req.GetParameter("descriptionTextarea")
params(10) = req.GetParameter("retailshopsInput")
params(11) =req.GetParameter("postersInput")
params(12) = "unknown"
params(13) ="0"
sql.execnonquery2(query,params)
It seems like the data is coming through but I cannot find the method of extracting it
<form method="POST" action="/malladd">
</form>
Maybe it is a Sunday problem.
I am using HTMX to swap out the Select Areas and also to SWAP out the Searchable Fields.. I tried Choices.js but found it was not working for me as I had more than one field to use the plugin and it would not support that. So I eventually used datatables
B4X:
<div class="col-lg-4">
<label for="provinceSelect">Province</label>
<br>
<input list="provinceSelectlist" name = "provinceSelect" autocomplete="nope" hx-get="/muni" hx-target="#municipalitySelectlist" placeholder="Search Province">
<datalist id="provinceSelectlist">
<#list provincetable as provincetables>
<option value="${provincetables.province}" >
</#list>
</datalist>
</div>
<!-- State -->
<div class="col-lg-4">
<label for="municipalitySelect">Municipality</label>
<br>
<input list="municipalitySelectlist" name = "municipalitySelect" autocomplete="nope" hx-get="/suburb" hx-target="#suburbSelectlist" placeholder="Search Municipality">
<datalist id="municipalitySelectlist">
<#list municipalitytable as municipalitytables>
<option value="${municipalitytables.city}">
</#list>
</datalist>
</div>
<div class="col-lg-4">
<label for="suburbSelect">Suburb</label>
<br>
<input list="suburbSelectlist" name = "suburbSelect" autocomplete="nope" placeholder="Search Suburb">
<datalist id="suburbSelectlist">
<#list suburbtable as suburbtables>
<option value="${suburbtables.suburb}" >
</#list>
</datalist>
</div>
Thank you
Last edited: