This line of code is meant to use POSTBACK:
<form action = "<?php echo $_SERVER["PHP_SELF"];?>" method="post" />
i keep getting these errors:
Line 73, Column 46: an attribute value literal can occur in an attribute specification list only after a VI delimiter
Line 73, Column 47: character data is not allowed here
What exactly is wrong with the code to bring up these errors???
And i have to use this particular method to get full marks.
Also with this code:
<input type="password" name="password" id="password" size="" maxlength="20" />
it keeps bringing up this error:
Line 78, Column 78: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
Help?
From the code you have provided I would say that your input tags are not inside a "container" tag. (your p's, div's, span's etc)
wrap your inputs in one of those and it should remove that validation message:
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<p> <!-- CONTAINER TAG FOR VALIDATION -->
Checkbox: <input type="checkbox" name="checktest" value="on"
title="checkbox sample"><br>
RadioButton1: <input type="radio" name="rbtest" value="one"
title="radio button1 sample"><br>
RadioButton2: <input type="radio" name="rbtest" value="two" checked="checked"
title="radio button2 sample"><br>
Text: <input type="text" name="texttest" title="text input sample"><br>
Password: <input type="password" name="passtest" title="pwd sample"><br>
<input type="submit" value="Send"> <input type="reset">
</p>
</form>
Regarding your other messages, this is what the W3C documentation states about the errors you are receiving:
Line 73, Column 46:
111: an attribute value literal can occur in an attribute specification list only after a VI delimiter
Have you forgotten the "equal" sign marking the separation between the attribute and its declared value? Typical syntax is attribute="value".
As mentioned you should not have the space between action and =
Line 73, Column 47:
63: character data is not allowed here You have used character data
somewhere it is not permitted to appear. Mistakes that can cause this
error include:
putting text directly in the body of the document without wrapping it
in a container element, or forgetting to
quote an attribute value (where characters such as "%" and "/" are
common, but cannot appear without surrounding quotes), or using
XHTML-style self-closing tags (such as ) in HTML 4.01 or
earlier. To fix, remove the extra slash ('/') character.
This one is probably because you are self-closing the form tag
change it to:
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
(replace the /> with >)
Related
I have a problem with $_POST. I am adding data to my mysql database with this code and it is working.;
if (isset($_POST["d_kayit"])){
$denetci=$dbpdo->prepare("INSERT INTO denetciler(name,pass) VALUES(:name, :pass)");
$denetci->bindParam(":name",$_POST["denad"],PDO::PARAM_STR);
$denetci->bindParam(":pass",$_POST["sif"],PDO::PARAM_STR);
$denetci->execute();
}
But in the same form i want to use $_POST["denad"] for another insert. It is giving me "Notice: Undefined index: denad in" error. Sample code that giving error is;
if (isset($_POST["add"]))
{
echo "Person: ".$_POST["denad"];
}
Can you help me please?
If this:
if (isset($_POST["add"]))
{
echo "Person: ".$_POST["denad"];
}
is yielding notice: Undefined index: denad then you probably don't have inputs "add" and "denad" on the same form. Or it is an unchecked checkbox.
Edit based on the code of your HTML form. You'll need something like this, you can't end your form with </form> like you did until you included all needed input fields:
<form action="" method="post">
<!-- content here -->
<input name="denad" id="denad" type="text" style="margin-top:2px; width:200px; height:30px;"></input>
<input type="submit" class="get_file" id="K_ekle" name="add" onclick="test()" value="Kişiye Ekle" style="float:left;"></input>
<!-- more content here -->
</form>
What is the syntax to include hidden field in HTML Template Language (HTL)?
In jsp we can write
<input type="hidden" id="thisField" name="inputName" value="hiddenValue"/>
You would do the exact same thing in HTL.
<input type="hidden" id="thisField" name="inputName" value="hiddenValue"/>
I want to localize Submit button in ASP.NET MVC application but don't know how to inerpolate it into value attribute.
<input type="submit" value="Resources.Global.Create" />
It prints Resources.Global.Create on form, but it should print localized value not variable name.
You're missing the magic Razor character (#):
<input type="submit" value="#Resources.Global.Create" />
Folks,
I am using watir-webdriver, I have a piece in my HTML DOM which gets generated on the fly when I enter some credentials, this piece has a bunch of checkboxes, the number of checkboxes vary, I have to select one checkbox, below is an example of this, here I want to select the second checkbox(the one that has value "BS" for the input type hidden but the value for input type checkbox is same for all):
<li class="dir">
<input type="checkbox" value="1" onclick="$(this).next('.should_destroy').value = (this.checked?0:1)" name="should_not_destroy">
<input class="should_destroy" type="hidden" value="1" name="import[dir_attributes][][should_destroy]">
<input type="hidden" value="" name="import[dir_attributes][][id]">
<input type="hidden" value="Automation" name="import[dir_attributes][][path]">
<span class="dir_mode">Include</span>
Automation
</li>
<li class="dir">
<input type="checkbox" value="1" onclick="$(this).next('.should_destroy').value = (this.checked?0:1)" name="should_not_destroy">
<input class="should_destroy" type="hidden" value="1" name="import[dir_attributes][][should_destroy]">
<input type="hidden" value="" name="import[dir_attributes][][id]">
<input type="hidden" value="BS" name="import[dir_attributes][][path]">
<span class="dir_mode">Include</span>
BS
</li>
I may be able to do this with XPATH, but wanted to try a non XPATH solution. The input type hidden has the appropriate value that I need, for example above the second checkbox has value "BS" for input type hidden. I tried to use the hidden method like this:
h = ##browser.hidden(:value, "BS")
h.select
But I dont know what to do after this. I am trying to select the checkbox based on the value of the hidden element. Any feedback is much appreciated.
I would suggest using the visible elements instead. I think it makes it easier to read the test and seems more stable.
Try:
##browser.li(:class => 'dir', :text => /BS/).checkbox.set
Here we go, I think this will do it
Since you have to select the checkbox based on the hidden, you're going to have to go up a level to the containing li, then drill down to the checkbox
#browser.hidden(value: 'BS').parent.checkboxes.first.set
i have a hidden_tag like this in my form
<%= f.hidden_field :loc , {:multiple => true} %>
which renders to
<input id="business_loc" multiple="multiple" name="business[loc][]" type="hidden" style="color: rgb(175, 175, 175); " value="">
currently am setting the business_loc value as a comma seperated string hoping rails would recognize when submit the form. But this is the value i got on the server side
"loc"=>["80.22167450000006,13.0454044"]
instead
"loc"=>[80.22167450000006,13.0454044]
how do i set the correct value in hidden field, so rails can understand it correctly.
You need to use multiple hidden fields, one for each element of the array of values.
For example:
<input id="business_loc" multiple="multiple" name="business[loc][]" type="hidden" style="color: rgb(175, 175, 175); " value="80.22167450000006">
<input id="business_loc" multiple="multiple" name="business[loc][]" type="hidden" style="color: rgb(175, 175, 175); " value="13.0454044">
...if you need code to dynamically add these with JS, here's a jQuery example:
var field = $('<input id="business_loc" multiple="multiple" name="business[loc][]" type="hidden" style="color: rgb(175, 175, 175); " value="13.0454044">');
var form = $('#your-form-id');
form.append(field);
I've found text_area's to make things work without having to add a bunch of hidden forms. Just set the value of the text area to something that looks like [1,31,51,61] and it should work, assuming in your model you have serialize :var
I had this same problem recently. My solution was to handle it on the server side by simply splitting the array at the comma. In my case it looks like this:
# thing_that_has_many_objects.rb <-- showing custom setter method from the model because my example involves using a virtual attribute
# params[object_ids] = ["1,2,3,4,5"] <-- from the form - note the format of array with only one element
def objects=(object_ids)
split_array = object_ids[0].split(',')
split_array.each do |id|
self.objects.build(object_id: id)
end
end