w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
HTML-form does not post back anymore after post with content-disposition
Well, the problem was something of my own. On the page a script was loaded which disabled all submit buttons after they where pressed to prevent multiple post backs. So no weird feature of bug, but a own made problem.

Categories : PHP

HTML form POST to AJAX and then POST to PHP page
HTML: <div> <p><b> Search all videos in database below: </b></p> <ul> <li> <label for="keywords">Keywords</label> <input type="text" id="keywords" name="keywords" size="50" maxlength="64" /> </li> <li> <button onClick="loadData()">Search</button> </li> </ul> </div> <div id="container"> </div> Javascript: $(document).ready(function(){ // ... function loadData() { loading_show(); $.ajax ({ type: "POST", url: "http://yourwebsite.com/search_videos.php", data: { 'keywords': $('#keywords').val() }, success: function(msg) {

Categories : PHP

How to use ModelState to clear my form after I post my form data,my view model is a viewmodel which has two models?
In such case you will have to remove each property of StudentModel from your ModelState i.e. Syntax: ModelState.Remove("PropertyName"); Example: ModelState.Remove("Id"); ModelState.Remove("Name"); ModelState.Remove("Marks"); Edit: For specific model property in among two ModelState.Remove("StudentModel.Name");

Categories : Asp Net Mvc

is char** x = (char**) arg equivalent to reinterpret_cast(const_cast(arg) )?
Yes they are basically the same except the c++ style cast shows the reader of the code that you are doing some weird stuff while its harder to notice with the c style. Its legal yet as always its highly suspect when a const incoming parameter is being cast as non const.

Categories : C++

Display PHP POST results after a form submit, then reload same blank form when page "Refresh" clicked
Try this code. You need to use JS to refresh without POSTing again. <!DOCTYPE html > <head> <title>Refresher test</title> </head> <body> <br/><br/><h2>What Me Refresh</h2> <?php //If form not submitted, display form. if (!isset($_POST['submit'])||(($_POST['text']) == "")){ ?> <p><h3>Enter text in the box then select "Go":</h3></p> <form method="post" action="RfrshTst.php" > <textarea rows="5" cols="50" name="text" > </textarea> <input type="submit" name="submit" value="Go" /> </form> <?php //If form submitted, process input. } else { //Retrieve show string from form submission. $txt = $_POST['text']; echo "The text you entered was : $txt"; ?> <button on

Categories : PHP

Selectively post form to different pages, based on form result?
You may try something like this HTML: <form action="delete.php" method="post"> <input type="checkbox" name="confirmDelete" value="confirm" /> <input id="btn_delete" type="submit" value="delete" /> </form> JS: window.onload = function(){ document.getElementById('btn_delete').onclick = function(e){ var checkBox = document.getElementsByName('confirmDelete')[0]; if(!checkBox.checked) { if(e && e.preventDefault) { e.preventDefault(); } else if(window.event && window.event.returnValue) { window.eventReturnValue = false; } alert('Please check the checkbox!'); } }; }; DEMO.

Categories : PHP

Ajax prevent form action and post form data
A quick thing i noticed. form = $(this) //it is holding submit button, not the form emailcode = form.serialize(), formUrl = form.attr('action'), //there is no attribute `action` to select because form is holding submit button formMethod = form.attr('method'); //similarly, there is no attribute method change your form selector to: form = $('#emailForm')

Categories : PHP

PHP Form: Want to have a drop down selection with two values that post to different fields in the form
You could split the submitted value based on the | and use the retrieved values to insert into the database. $toyInput = $_POST["toyInput"]; $toySplit = explode("|", $toyInput); $toyID = $toySplit[0]; $toyName = $toySplit[1]; // Now insert $toyID and $toyName into your DB in separate fields. Be aware that this has no validation, a user could easily put fake ID's, names, or a value with no "|" and cause your script to error out. Be sure to add extra checks for these cases!

Categories : PHP

storing foreign key, not from the form POST method, but by form data I already have
Don't try to assign int for payment.student. Assign student instance. payment.student = student.get(pk=1) # Desired value `1` for foreign key assumed Moreover you should follow coding style rules (read about PEP8): class names started with capital letters field names not started with capital letters variables and fields don't use camel case - class names do Your code will work without this rules but as Python Developers we have some standards for readable code. And in Django you don't have to define primary key field - it's created automatically and accessible with instance.pk. And I'm not sure if you really want your foreign key to point to student column of student table. And you can just import student model if it's defined in other module. So with these corrections your class

Categories : Python

How to fix invalid/stripped json?
You can use jsonlist it's a pure implementation in JavaScript for validating JSON. According to the validation you'll know what is missing in the end and add the missing value. you can also check a demo online

Categories : Mysql

Post Form Action to variable inside form
Using javascript you could change the form action on form submit (onsubmit). <script type="text/javascript"> function get_action(form) { var user = document.getElementById('userid').value; form.action = "importphotos.php?view=500&mode=upload&page=1&u=&u2=&500pxuserid=" + user; } </script> <form action="" method="post" onsubmit="get_action(this);"> ... // add id=""userid" to input <input ... type="text" name="500pxuserid" id="userid" /> </form>

Categories : PHP

Passing post data from one form to second form in CodeIgniter
please create 2 views (1st form and 2nd one) the logic is easy show default view (1st view where user sets the state/zip or w/e) -> validation -> if true, set $data['zip'] and render 2nd view where this line should be (remember to not render also 1st one) <input type="text" name="zip" value="<?= (isset($zip)) ? $zip : set_value('zip'); ?>" /> another aproach is to use $this->session->set_flashdata('zip', $zip_variable); and right after redirect() to the controller with 2nd view in it. in controller somewhere (might be in construct or desired method) put this line which gets zip value from flash data (session variable for one use only) if ($zip = $this->session->flashdata('zip')) $data['zip'] = $zip; and now load 2nd view with $data parameter and use <i

Categories : PHP

p tag being stripped from advanced custom fields
Glad you solved it. If you were wondering why this happens, I'm thinking the plugin uses KSES to to strip out potentially malicious code. http://codex.wordpress.org/Function_Reference/wp_kses Unfortunately, it also removes most HTML tags unless you specifically allow them. Glad you figured out a workaround (a pretty simple and clever one, by the way).

Categories : Wordpress

What does stripped JARs (no bytecode for methods) mean?
Normally, the class files in a jar file will contain information on the line numbers relating to the code in the class - this is called the debug information. A stripped jar simply does not have this information. You are correct in assuming this is the problem. The stack trace you see won't contain any line numbers relating to the code in the stripped jar. Since the jar is provided by a third-party, there's nothing you can do to get that information.

Categories : Java

jquery - convert string to object, url got stripped
You need to make sure that you get only two chunks after split(): Instead of this: var parts = att[i].split(':'); Do this: var parts = att[i].split(':'); parts = [parts.shift(), parts.join(':')]; Example: > parts = 'background-image:url("http://localhost/xyz.jpg");'.split(':') ["background-image", "url("http", "//localhost/xyz.jpg");"] > parts = [parts.shift(), parts.join(':')] ["background-image", "url("http://localhost/xyz.jpg");"]

Categories : Jquery

How to Make sure iOS application stripped of debug symbols?
You probably want to set Strip Debug Symbols During Copy to YES for Release/Distribution configurations. You can compare binary size, the one with debug symbols will be larger. Debug symbols basically means that extra debugging information is included in the binary (e.g. method names are not stripped/removed etc.). Usually when building with Xcode, it creates a special file that contains these symbols which are later used for let's say symbolicating crash reports.

Categories : IOS

Converting Decimal to char* in C++ windows form application
What do you mean by Decimal? Perhaps int? See itoa() in the C runtime, or template<typename T> std::string to_string(T num) { std::ostringstream stream; stream << num; return stream.str(); } and call TiXmlText(to_string(666).c_str());

Categories : Visual C++

zebra stripped with round corners not working in Firefox
Try changing this bit of CSS: .zebra tbody tr:nth-child(even) { background: #F0F0F0!important; color:#000; } to this... .zebra tbody tr:nth-child(even) td { background: #F0F0F0!important; color:#000; }

Categories : Firefox

Empty strings in postgres string array getting stripped out
These articles might help: Storing arrays in database using ActiveRecord rails store array in to database field http://api.rubyonrails.org/classes/ActiveRecord/Base.html#method-c-serialize It looks like you need to serialize the column: class MyStuff < ActiveRecord::Base serialize :things end

Categories : Ruby On Rails

msdb.dbo.sp_send_dbmail Invalid Recipients get stripped out automatically
You won't get the error, but the results (failure and success) are stored in msdb. Following views sysmail_allitems, sysmail_sentitems, sysmail_unsentitems, sysmail_faileditems are available in msdb for this purposes. More here: http://technet.microsoft.com/en-us/library/ms191278.aspx

Categories : SQL

Stripped first X characters from string in shellscript using SED and now store as variable?
You can just keep the echo: myVar=$(echo "$myString"| sed -r 's/^.{5}//') or use a here-string: myVar=$(sed -r 's/^.{5}//' <<<"$myString")

Categories : Regex

Symbols loaded (source information stripped) error when creating C++ program
It's not an error. Since you're running your program under a debugger, it tries to load symbols for each loaded DLL. Symbols are extra information needed to match runtime memory addresses to addresses of functions, local variables etc. "Source information stripped" means source code information has been stripped away. You'll notice you get this message for Microsoft binaries. You can notice you get full symbols for the code you compile yourself.

Categories : C++

Appending and substracting divs filled with data from one simple form to a form that contains all the divs grouped and ready to POST
So you want to have the order items listed in the second form like a pre-checkout shopping cart. If you use divs for that, they will not be submitted with the POST data to the server - they will be display-only. So you need to follow Robert's advice and save the 1st form's data to the DB each time an item is added/removed (in addition to his other reasons like not losing a customer's session info). That way the DB will already be up-to-date when they click Confirm Order. Or else you need to hook the Confirm Order button to a JS function that converts the divs back to JSON and posts that to the server to be stored in the DB. As far as creating the display-only div from the 1st form's data, your send_item_data function needs to loop over all the form's inputs, get their values, and add

Categories : PHP

what is the difference between form submission using ajax() method or by simply
to servlet or php
Put simply, using 'ajax' doesn't cause a page refresh, so could result in a better user experience, lower data transfer usage (because you can just send a result like 'OK' or an error message rather than a full page), and cleaner code. But if you want to have a complete refresh, there is no reason not to use the traditional form submission method.

Categories : Ajax

PHP/MySQL variable in URL - text being stripped out and numerical part only used in selecting database records
That's MySQL "helpfully" converting 12agsgs to a number for you (and coming up with 12), because it knows the id column is numeric. You can make it stop by doing a BINARY comparison: SELECT * FROM `tablename` WHERE BINARY `id` = '$id'

Categories : PHP

Process form data using PHP_SELF second button to post form data to another page
The only way you're going to be able to do that is to use javascript (most likely jQuery) to change the action of the form when the button is clicked. If it were me, I would set the form action to be the one that you want for your print button. And then use jquery/ajax to call your script (or if they can be done with javascript, do them on the client side and save the post to the server) to do the calculations when that button is clicked.

Categories : Javascript

dijit/form/form issues POST issues in firefox
First, change the data-dojo-type into path format. E.g.: dijit/form/ValidationTextBox Second, fix your typing mistake in password field of data-dojo-type. You entered data-dojotype, missing the - b=in between 'dojo' & 'type' More information about dojo.byId() & dijit.byId(). Here is the result: <div data-dojo-type="dijit/form/Form" data-dojo-id="myform" id="loginform" encType="multipart/form-data" action="" method="post"> <script type="dojo/method" data-dojo-event="onSubmit"> if(this.validate()){ senddata(); //calling the javascript function }else{ alert('Form contains invalid data. Please correct first'); return false; } return true; </script> <table cellspacing="10">

Categories : Forms

post some inputs that is inside an iframe,that is inside a form,as a whole form
what I did was, I just moved the inputs I needed filled, to my main window(parent) and used a function in the parent to handle generated data in the iframe using: window.parent.myfunction(data); whenever I needed to pass data from scripts in iframe to parent window, I did the above. cheers

Categories : PHP

Unable to pass an address of array of type char *[2] to function taking char ***
char *array[2] = {"string", "value"}; is an array with 2 elements of char *. Using array as an address results to a pointer to the first element, i. e. of type char **. Using &array results to a pointer to the same place, but of type char *(*)[2] (not sure if the spelling is right). This is not the same as a char *** - the representation in memory is completely different. To be more verbose, +++++++++++++++++++++++ + array[0] + array[1] + +++++++++++++++++++++++ this is the array. char ** p1 = array; // is a pointer to the first element, which in turn is a pointer. char *(*p2)[2] = &array; // is a pointer to the whole array. Same address, but different type, i. e. sizeof(*p1) != sizeof(*p2) and other differences. char ***p3 = &p1; // Now, p1 is a different pointer va

Categories : C

Templatized ostream overload ambiguity error : basic_ostream vs const char[]
The non-template operator does not cause any ambiguity because that operator itself is not viable for resolving this call: return out << "a1"; // ^^^^^^^^^^^ // This MUST be `std::operator <<`, no other valid overload of // operator << is found! As well as the other similar ones. The template version, on the other hand, is viable, since T is not bound to be any concrete type: template <class T> ostream& operator<<(ostream& out, const T& a) { switch(a) { case T::a1 : return out << "a1"; // ^^^^^^^^^^^ // Here the compiler could invoke std::operator << // OR it could invoke your operator << template, // which is also viable since T could be anything! //

Categories : C++

char pointers, char arrays, and strings in the context of a function call
The char[] signature in the parameter is exactly the same as char*. In C++, it is illegal to convert a string constant char const* (the string "Kacy") to a char* because strings are immutable. Your second example compiles because the name is an actual array. There is no change to char*. As a solution, change your parameter to take a const string array: Student(char const name[]); which again is the same as String(char const *name); though you're better off using std::string: #include <string> class String { public: String(std::string name); };

Categories : C++

How to disable type char in JTextArea but enable removed char (Backspace)
try to put DocumentFilter instead of DocumentListener something like final AbstractDocument abstractDocument = (AbstractDocument) textArea.getDocument(); abstractDocument.setDocumentFilter(new DocumentFilter() { @Override public void remove(final FilterBypass fb, final int offset, final int length) throws BadLocationException { super.remove(fb, offset, length); } @Override public void insertString(final FilterBypass fb, final int offset, final String string, final AttributeSet attr) throws BadLocationException { if (getLineCountAsSeen(textArea) < 4) { super.insertString(fb, offset, string, attr); }

Categories : Java

C - Sort char string in array to equal char user input
OK, so basically you want to convert a sorted array of letters to a specific (random?) ordering and record the swaps along the way, right? Here is one way to do this. #define SWAP(a,b) a^=b;b^=a;a^=b int main(int argc, char* argv[]) { char* wordInput=argv[1]; char* newWord = (char*)malloc((strlen(wordInput) + 1) * (sizeof(char))); int i,j,k; fprintf(stdout, "Word is %s ", wordInput); // Sort wordInput into newWord. for (i=0; i<strlen(wordInput); i++) { // Put this one at the end. newWord[i]=wordInput[i]; // Start at the back of the string, and move it forward if it is less. for (j=i-1; j>=0; j--) { if (newWord[j+1] < newWord[j]) { SWAP(newWord[j+1], newWord[j]); } else { break; } } } newWord[strlen(wordInput)]

Categories : C

How can I write a function boolean succeeds(char a, char b, String s)? using s.equals(""), s.charAt(0), s.substring(1)
Something like this should work. I have not compiled this. Hopefully it gets you in the right direction, even with possible syntax errors. public boolean succeeds(char a, char b, String s){ boolean sawFirst= false; for(int i=0;i<s.length();i++){ if(!sawA){ if(s.charAt(i)==b) sawFirst = true; } else{ if(s.charAt(i)!=a) return false; else sawFirst= false; } } return true; }

Categories : Java

What to call method which returns char* ( String in Java and char* in C++)?
It returns a String object and you can use the JNI string functions to convert that string to a char*: char* gPGGetName() { jobject objStr = env->CallObjectMethod(g_Obj, g_s3eGPGGetName); jsize len = env->GetStringUTFLength(objStr); const char* strPtr = env->GetStringUTFChars(objStr, 0); char* buffer = (char*)malloc((len + 1) * sizeof(char)); memcpy(buffer, strPtr, len); buffer[len] = ''; env->ReleaseStringUTFChars(objStr, strPtr); return buffer; }

Categories : Android

Printing the memory representation of an integer using char* and unsigned char*
This is because (on your system) char is signed, and it's getting promoted to int in the printf() call. Use unsigned char: void print_bytes(const unsigned char *ptr, size_t len) { for(size_t i = 0; i < len; ++i) { printf("%p %x ", ptr + i, ptr[i]); } }

Categories : C

How compare a char / single char string - with some list of alphabets set
If the starting letter is always an English character (or anything representable by a reasonably small integer that fits into an unsigned char), then here's a solution (the fastest possible one I can think of - uses no jumps except for the first check for initialization and only plain old integers are used instead of the somewhat heavier-weight comparison of NSString instances): - (UIColor *)colorFromName:(NSString *)name { static UIColor *strs[1 << CHAR_BIT] = { nil }; static BOOL initted = NO; if (!initted) { strs['a'] = [UIColor greyColor]; strs['b'] = [UIColor whiteColor]; // ... strs['z'] = [UIColor blueColor]; initted = YES; } unsigned char first = tolower([name characterAtIndex:0]); return strs[first]; }

Categories : IOS

Why does GCC accept convertion from 'const char *' to 'char *' on std::strrchr() returned value?
Actually your g++ does not accept the conversion from 'const char *' to 'char *', it's just that on your version std::strrchr() returns a char* (incorrectly, instead of a const char*). To verify the first part of my statement, try to compile the following on your GCC versions, I predict that all will correctly issue an error: int main() { const char* p = "foo"; char* q = p; // error, invalid conversion from 'const char*' to 'char*' } Now for the second part, I tried to compile the following minimal code, whose actual aim is to trigger an error in order to list the declared overloads of std::strrchr: #include <cstring> void (*p)() = &std::strrchr; // error here, with "candidates are: ..." int main() {} Well, with gcc 4.7.2 the message shows the expected "all non-c

Categories : C++

Regarding type safety when storing an unsigned char value in char variable
"does this mean that char could maintain its 'signedness' throughout the comparison?" yes; -1 as a signed char will be promoted to a signed int, which will retain its -1 value. As for the unsigned char, it will also keep its 255 value when being promoted, so yes, the comparison will be false. If you want it to evaluate to true, you will need an explicit cast.

Categories : C

Form post not working
There is too much wrong but for a start there is no function called my_query. On your second last line in the PHP. If I were you I would check the PHP code works properly first using basic GET variables or something, and then work on the POST variables. When you finished that, your code is subject to mysql injection. You need to take a look at stopping these deprecated mysql_ functions and move to a supported type like PDO.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.