How can i auto get form's data for perl6? - raku

a form like this:
<form action='1.php' method='post'>
u:<input name='u' type='text'/><br />
p:<input name='p' type='password'/><br />
<input value='submit' type='submit'/>
</form>
and how can i auto get the form data use perl6?
lkie this:
my $form = xxx($the_form_url)
and the result like this:
$form.Str
#output like that:
#u=username&p=password&submit=submit
have shome modules in perl6?
please..

Bailador is indeed a good tip.
But if you want a more CGI-line approach, have a look at SCGI;
https://github.com/supernovus/SCGI

Related

How can I render the input with type='text' in blazor server-side?

Here are the codes:
<EditForm OnValidSubmit="#SubmitText" id="inputText">
<InputText #bind-Value="_InputMsgModel.Msg" />
</EditForm>
After the program ran, it turned out to be this:
<form id="inputText">
<input class="valid">
</form>
Now I wanna add an attribute type="text" to the input element, how can I achieve this?
I tried to modify the code like this:
<EditForm OnValidSubmit="#SubmitText" id="inputText">
<input type="text" #bind-Value="_InputMsgModel.Msg" />
</EditForm>
Meanwhile, now visual studio reports an error:
I can not bind the model anymore.
I need to set the type to text for needing to set the keyboard in mobile correctly.
How can I solve this? Thank you.
What is wrong with this code:
<EditForm Model="#_InputMsgModel" OnValidSubmit="#SubmitText" id="inputText" >
<InputText #bind-Value="#_InputMsgModel.Msg" />
</EditForm>
Run this code with the above:
#code {
InputMsgModel _InputMsgModel = new InputMsgModel();
private void SubmitText()
{
Console.WriteLine(_InputMsgModel.Msg);
}
public class InputMsgModel
{
public string Msg { get; set; } = "My new message";
}
}
Do you see the text "My new message" in the text box ? I believe you do... All is well, and the two-way binding mechanism works well. Go and see now the Html...it's still <input class="valid"> which does not reflect the real state of the text box. Think about it...
Update: Of course you can use the following:
<EditForm Model="#_InputMsgModel" OnValidSubmit="#SubmitText" id="inputText" >
<input type="text" #bind-value="#_InputMsgModel.Msg" />
</EditForm>
Important: The error "The attribute names could not..." is triggered because you use capital "V" in #bind-Value. You should use lower case: #bind-value. This is because your using input 'Html element' here, and it has a value attribute, not a Value attribute. But when you use the InputText Component, the capital Value in #bind-Value refers to a Value property defined in the component.

How to add a property with the same name in VueJS?

So I am using a component framework for Vue2 named vuetify and I am having a problem regarding the class of the input textbox.
So in the textbox component, the code is:
<template lang="pug">
div(
class="input-group"
v-bind:class="classes"
)
label(
v-bind:for="id"
v-html="label"
)
input(
v-bind:id="id"
v-bind:name="name"
v-bind:placeholder="placeholder"
v-bind:required="required"
v-bind:type="type"
v-bind:value="inputValue"
ref="input"
)
</template>
Now I want to add a class in the text input because I want it to be a date and I am using the flatpickr plugin. The name of the class is flatpickr. So the way I use the component is like this:
<v-text-input id="someID" label="SomeLabel" v-model="someModel"></v-text-input>
And if I try to add the class random I do it like this:
<v-text-input id="someID" label="SomeLabel" v-model="someModel" class="flatpickr"></v-text-input>
The code isn't working because the class goes to the div. I checked the code generated in the elements of chrome and it looks like this:
<div class="input-group flatpickr" data-v-3eb87e8e="">
<label for="SomeLabel">SomeLabel</label>
<input id="someID" type="text">
</div>
As you can see, the class goes to the class of the div. What's the best way/trick to add a class in the text input? Any help would be much appreciated.
You can apply the same CSS property, by giving path of your input like following:
.random input{
height: etc;
}
Edit
Given that you are also getting id of the input box, to apply the class on specific input, you can also use the id:
.random #someid{
height: etc;
}
to add the class into <div> tag is the design of Vue, the class added into components will be rendered into the top level of the element in the template.
https://v2.vuejs.org/v2/guide/class-and-style.html#With-Components
If you want to apply the css to <input>, you can simply do:
.random input {
/* your css style */
}
If you want to use flatpickr with vuejs, you can try to use this vue-flatpickr component, https://github.com/jrainlau/vue-flatpickr

struts 1.1 tiles inside html:form

Hello I had a form that looks like this:
<form target ="_blank" id="downloadFrm" name="downloadFrm" action="<tiles:getAsString name="downloadFileName" ignore="true"/>" method="post">
But I want this form to be a html:form, something like:
<html:form target ="_blank" styleId="downloadFrm" action="<tiles:getAsString name="downloadFileName" ignore="true"/>" >
But I can't have the "!tiles.getAsString inside the html:form.
I get equal symbol expected.
Can this be fixed?
Please try to assign the action to variable as follows and use it in html:form
<c:set var="actionPath"><tiles:getAsString name="downloadFileName" ignore="true"/></c:set>
<html:form target ="_blank" styleId="downloadFrm" action="${actionPath}" />

Disabling radio button in jsp based on map value struts2

I'm trying to use a boolean value returned from a map in my bean to either disable/enable a radio button in a jsp page.
Class snippet:
public class Options{
private String optionId;
private Map<String,Boolean> negativeMap;
public setNegativeMap(Map<String,Boolean> negativeMap){
.......
}
JSP snippet:
<input id="radioClick<s:property value=optionId"/> type="radio" disabled="%{negativeMap[optionId]}" />
Am I on the right track with this? Is there something I'm missing?
Please, I think your JSP snippet was wrong near "value=optionId"/>" :
<input id="radioClick<s:property value=optionId"/> type="radio" disabled="%{negativeMap[optionId]}" />
Your JSP snippet should be like this :
<input id="radioClick<s:property value=optionId/>" type="radio" disabled="%{negativeMap[optionId]}" />

MySQL query using multiple criteria from checkboxes

I would like to do a multiple search query usig multiple checkboxes which represent particular textboxes.
How do i create a mysql query which will be filtering the checked and unchecked checkboxes (probably using if statements)?
The query should be able to filter the checked and ucnchecked boxes and query them using the AND condition.
Thanks
Mysql won't be able to handle your html form post. You will need to use a server-side language to check for those checkboxes being set and then modify your query with additional conditions.
You would likely get a better response if you were more specific, but I'll throw you an example with php. Assuming your form looks something like:
<form method="post">
<input type="checkbox" name="field1_cb" value="1" />
<input type="text" name="field1_txt" />
<br /><br />
<input type="checkbox" name="field2_cb" value="1" />
<input type="text" name="field2_txt" />
</form>
Your server code might look something like:
$query = "SELECT * FROM tbl WHERE field0 = 'asdf' ";
$fields = array('field1','field2');
foreach($fields as $f){
if(isset($_POST[$f.'_cb'])){
$query .= " AND $f = ".$_POST[$f.'_txt'];
}
}
//Run your query...
Please don't copy and paste this code directly, it is disgustingly insecure. Just trying to get you started.