-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Save the form #1
Comments
At the moment form data is stored as XML in a hidden textarea so saving the data should be the same as saving a normal textarea. I am working on a new demo now that will include save functionality for a php backend. |
Extracting the XML directly using toXML() Is there a way yet to render this back to HTML? |
@thewizster version 1.4 (just released) addresses this. Check the demo for usage. |
@kevinchappell I've been testing the new render feature. Working well so far. I'm testing under bootstrap 3. I'll let you know if I run into any issues. Great work! |
I have a XML data and I saved it to database. XML data returned from the database:<form-template>
<fields>
<field name="select-1447927575220" label="Select" style="multiple" description="" required="false" type="select" >
<option value="option-1">Option 1</option>
<option value="option-2">Option 2</option>
</field>
<field name="autocomplete-1447927571725" label="Autocomplete" description="" required="false" type="autocomplete" />
<field name="radio-group-1447927576634" label="Radio Group" style="multiple" description="" required="false" type="radio-group" >
<option value="option-1">Option 1</option>
<option value="option-2">Option 2</option>
</field>
<field name="date-input-1447927572946" label="Date Field" description="" required="true" type="date" />
<field name="checkbox-group-1447927574129" label="Checkbox Group" style="multiple" description="" required="false" type="checkbox-group" >
<option value="option-1">Option 1</option>
<option value="option-2">Option 2</option>
</field>
</fields>
</form-template> I tried the following Options:HAML Code:
The session[:form_template] is returned value from the database and i am assigning it to textarea. Javascript Code jQuery(document).ready(function($) {
var template = document.getElementById('form-builder-template'),
formContainer = document.getElementById('rendered-form'),
renderBtn = document.getElementById('render-form-button'),
formRenderOpts = { container: $(formContainer) };
$(template).formRender(formRenderOpts);
//$(template).formBuilder();
$(renderBtn).click(function() {
console.log('--------before rendering----------');
$(template).formRender(formRenderOpts);
console.log('---after rendering -----');
});
}); Well I got both logs before rendering and after rendering but still nothing loads on #rendered-form div ? Am i missing something here? |
Can you log the Here is a minimal usage example. http://jsfiddle.net/kevinchappell/yzr2p5y4/ |
I logged $(template).val()? |
I did a Silly thing actually. Solved my problem. |
Sorry im not sure as I have 0 rails experience but from what i see online assigning should have worked. |
Yeah that's right..!! |
@ashvushinde great!. best of luck. |
how to save data once the form is rendered and fill in with values.? |
Hi, |
Hi,
Thank you for the code to build forms online...
i am unable to write the code for saving the template..can u help me to do...
The text was updated successfully, but these errors were encountered: