|
Yes, you can do that using JavaScript, but after submitting the form, ALWAYS validate it from the server-side language (PHP in this case). The reason is that people could disable JavaScript in their browser, and then the text box wouldn't be validated anymore.
For the JavaScript, try this:
var inputField = document.getElementById('put-your-id-here');
inputField.onkeyup = function(e) {
e = e || window.event;
var re = /[^\w.]/;
inputField.value = inputField.value.replace(re, '');
};
|
|
|
|
|
No, that won't work, meanwhile many non-ASCII characters are allowed in URLs.
I'd suggest to send a HEAD request to the URL (e.g. before submitting or when leaving the text field) and check the return code (200=OK, everything else: wrong).
|
|
|
|
|
Hi,i have web application in my hosting with some provider. In the case where one (provider) is disabled, the other connections (providers) do not work, give advice on how to properly build a network for web hosting.
Thanks
|
|
|
|
|
Hi,
I have a PHP page.
I have MonthTo and YearTo drop downs to display the month and year.
and I have chkPresent checkbox.
I want to make the MonthTo and YearTo required only when the checkbox is NOT checked.
How can I do this in PHP please?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I am using this code to display years from 1950 to the current year in my drop down. I would like to know how can I modify this code to show the dates in desc order so current year will start first in the drop down?
<?php
for ($i = 1950 ; $i <= date('Y'); $i++)
{ echo "<option>$i</option>"; }
?>
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Like this perhaps:
<?php
for ($i = date('Y'); $i >= 1950; $i--)
{ echo "<option>$i</option>"; }
?>
Veni, vidi, abiit domum
|
|
|
|
|
it works.. Thanks
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I am using an input text in my PHP project for email address and password. I made the place holder for both so it will be easy for users to know what is every textbox form. but when I load the page the email address textbox will be autofocus therefore it will lose the placeholder then user needs to take the focus just to know what's this textbox?
Is there anyway to keep the placeholder text even when the cursor is focused so it will only be disappeared when the user starts typing.
Thanks
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
<doc>
<field name="id">1</field>
<field name="name">A</field>
<field name="sk">Acce</field>
<field name="level">Beginner</field>
<field name="do">Tuto</field>
<field name="open">1</field>
<field name="type">Ct</field>
<field name="extensis">cl_ex</field>
<field name="features">Atos</field>
<field name="downl"></field>
<field name="source">AtomicCounters</field>
<field name="description">Ths.</field>
<field name="tag1"></field>
<field name="tag2"></field>
<field name="tag3"></field>
<field name="tag4">Global</field>
<field name="tag5">Atomic</field>
<field name="tag6"></field>
<field name="tag7"></field>
<field name="tag8"></field>
<field name="tag9"></field>
<field name="tag10"></field>
</doc>
<doc>
<field name="id">2</field>
<field name="name">Ar</field>
<field name="sk">Acrce</field>
<field name="level">Beginner</field>
<field name="do">Tuto1</field>
<field name="open">11</field>
<field name="type">C1t</field>
<field name="extensis">cl_exd</field>
<field name="features">Atos</field>
<field name="downl"></field>
<field name="source">ddddd</field>
<field name="description">Thsdd.</field>
<field name="tag1"></field>
<field name="tag2"></field>
<field name="tag3"></field>
<field name="tag4">Global1</field>
<field name="tag5">Atomic1</field>
<field name="tag6"></field>
<field name="tag7"></field>
<field name="tag8"></field>
<field name="tag9"></field>
<field name="tag10"></field>
</doc>
Below is the code I am using..
<?php
$result="";
$document = new DOMDocument();
$document->load('http://index.websolr.com/solr/15b84f04a7e/select');
foreach($document->childNodes as $node)
$result[] .= $document->saveXML($node)."\n";
foreach($result as $key => $value)
{
echo "$key - $value<br/>";
}
?>
However it is displaying values only... like 1 Ar Acce....
I want like $field = id, $value = 1,$field = name, $value = A, $field = id, $value = 2,$field = name, $value = Ar,..
Any sugesstions please..
|
|
|
|
|
Hi,
I have a php file with cboMonth and cboYear drop downs and I have chkPresent in the same page.
I want to know how can I disable the cboMonth and cboYear and set both value to null if the chkPresent is checked?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Add this in HTML of chkPresent onclick=”AssignValueOnCheckboxTick(this.checked)"
Now Add this in Java Script
<script type="Javascript">
var cboMonth = document.getElementById('<%= cboMonth.ClientID %>');
var cboYear = document.getElementById('<%= cboYear.ClientID %>');
function AssignValueOnCheckboxTick(ischecked) {
if (ischecked)
{
var cboMonth.style.display = 'block';
cboYear.style.display = 'block';
}
else
{
cboMonth.style.display = 'none';
cboYear.style.display = 'none';
}
}
</script>
|
|
|
|
|
Hi,
I am having difficulties reading the bit value from MySQL and showing it in a checkbox in PHP.
The value is not showing and it's always unchecked!
This is what I am using:
$mysql_command = "CALL sp_get_member_personal_information(:param_member_guid)";
$mysql_query = $mysql_connection->prepare($mysql_command);
$mysql_query->bindParam(':param_member_guid', $_SESSION["member_guid"], PDO::PARAM_STR);
$mysql_query->execute();
$mysql_row_count = $mysql_query->rowCount();
if ($mysql_row_count <= 0) { exit(header("Location: home")); }
while ($mysql_row = $mysql_query->fetch())
{
$is_private = (bool)$mysql_row["is_private"];
$hide_contact_details = (bool)$mysql_row["hide_contact_details"];
}
and then:
<input type="checkbox" id="chkPrivateProfile" name="chkPrivateProfile" value="<?php echo $is_private; ?>"> My Profile is Private<br><br>
<input type="checkbox" id="chkHideContactDetails" name="chkHideContactDetails" value="<?php echo $hide_contact_details; ?>"> Hide my contact details<br><br>
I have no problem reading a varchar value but my problem is juts with the bit as it's my first time trying checkbox with php.
Please help...
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I have a database field value, to which i am trying to assign some static values at the metadata level. I want to see this as a dropdown list, with predfined static values. I heard you can achieve this dropdown by defining a foreign key relationship.
is there a way to do this without the table?
==
[DisplayNameAttribute("App Form")]
[UIHint("AppType")]
[Required]
public OptionType AppType { get; set; }</pre>
===
<pre>public enum OptionType
{
CheckBox=1,
radiobutton=2,
freeform=3,
dropdown=4
}
|
|
|
|
|
Hi,
I am building a dynamic questionnaire for our team.
With that said, all information is stored in database, like question text and its answers. Using LINQ to select out information and display on web page using asp.net aspx page.
We also stored the mandatory field in the database. On form submit, I am trying to check if all the mandatory questions were answered.
I am little stumped here - should I create the requiredfieldvalidators dynamically and check this manner? Should I add these validators on button_click or page_load? any other way to check for validation? I guess the challenge for me arises with the fact, i have check this in code behind page.
Thanks a lot!
|
|
|
|
|
Hi,
I have some include files in my PHP project, for example, I am including the meta tag because it's all the same..
I want to ask what's the best extension to use for include files? is it .inc or .php?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
hi,
I am using this to display titles drop down:
then in my insert.php I am reading the value like this:
$member_title = $_POST['cboTitle'];
what if I want to read the text NOT the value?
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I am using the following to let the user enter a url:
<input type="url" name="txtLinkURL" autocomplete="off" required style="width: 400px">
I want to know hot to make the box display http:// so user can't remove it?
Note: I am using PHP and HTML
Technology News @ www.JassimRahma.com
|
|
|
|
|
i have a map from google api which is shows a current location
<div id="map" style="height: 480px; overflow: auto;">
</div>
can i save this as image..??
thank you in advance...
|
|
|
|
|
Hi guys, I want to create an ordered list from a multiple select dropdown list, issue is the select option input provided by html only orders values picked linearly, but I want it ordered according to the order I select them at. So I decided to use some JS to do the trick but wsnt able to hack. Here's the code. Help out please!!
<script language='javascript'>
function showselection()
{
var frm = document.testing
var opt = frm.testsel
var numofoptions = opt.length
var selValue = new Array
var j = 0
for (i=0; i<numofoptions; i++)
{
if (opt[i].selected === true)
{
selValue[j] = opt[i].value
j++
}
}
selValue = selValue.join("+")
document.getElementById("txtEditions").innerHTML = selValue
}
</script>
<form method=POST name='testing'>
<select name='testsel' multiple onchange='showselection()'>
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select>
<textarea id="txtEditions"></textarea>
</form>
|
|
|
|
|
[edit] for the below to work in all browsers you should set teh ID of your select box to testsel - using the name property is all but redundant these days.
You do knwo there is a Javascript discussion forum? However, try this js:
function showselection() {
var s = document.getElementById("testsel");
var x = s.options[s.selectedIndex].value;
document.getElementById("txtEditions").value += x + '\n';
}
modified 22-Oct-13 12:22pm.
|
|
|
|
|
I have numerous interactive coloring pages that were created in Adobe Flash that need to be converted to HTML5. Because they use an older actionscript, Google Swiffy doesn't do a good job converting them.
I thought it might be easier to just start from scratch with my drawings. Is anyone aware of a free HTML5 solution that could work with the right graphic? I'd even be open to paying someone to code this for me.
It should work like this:
- Start with a line drawing (can be vector format, gif or png)
- Have a selection of about 40-50 colors (can be crayons or color dots)
- Pick a color and then click on the image to fill the space
- A white crayon serves as an eraser
- Option to print just the graphic to color offline
- Option to print finished coloring page in color
Thanks!
|
|
|
|
|
I have a Self referential Table. this is it's Model
<pre lang="c#">public partial class Title
{
public Title()
{
this.TitleChild = new HashSet<Title>();
}
public int Id { get; set; }
public string TitleText { get; set; }
public int? TitleId { get; set; }
public virtual ICollection<Title> TitleChild { get; set; }
public virtual Title TitleParent { get; set; }
}
when i Create a Controller and the View is made by scaffolding , there isn't anything for parent Field? I Have one field in page which is TitleText, how can i have the page for TitleText and its parent?
|
|
|
|
|
Hi,
I am using a datepicker. Everything is fine so far except the month in the datepicker. It's just showing the current month and not allowing user to select other months?
can anyone help please..
here is the code:
<input type="text" id="dateBirthday" name="dateBirthday" value="<?php echo $member_date_of_birth; ?>" autocomplete="off" readonly required>
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I would like to ask what's the best way to send emails through php webservices?
I have different websites in php and I want one centralized emailing procedures for all that's why I thought of web services... but I never used web services in php...
please advise....
Technology News @ www.JassimRahma.com
|
|
|
|
|
Sir;
I don't think web is a good choice for periodic tasks like messaging or emailing. you can add records in the database for these messages from your web services. Then another service process (daemon in Linux) checks for new records and send them. In this way you would keep track for your emails and you can resend them anytime. First of all you wont waste web server resources in sending emails.
Help people,so poeple can help you.
|
|
|
|